diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-12-15 04:01:53 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-12-15 04:01:53 +0000 |
commit | 3d8476edb402e2520b75da09a8b47382741d6534 (patch) | |
tree | 075722498f144e2c0d19b003c691c55c2f6600f9 /bin | |
parent | c8552c2995ea07790a077adeb89534b7005969b8 (diff) |
getcwd() operates on buffers of PATH_MAX including the NUL, and the +1
is not unneccesary. Different buffer sizes are actually dangerous, though
major problems are strangely rare.
ok millert
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/misc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c index 672b5416419..3d1e0cd4afb 100644 --- a/bin/ksh/misc.c +++ b/bin/ksh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.76 2020/10/26 18:16:51 tb Exp $ */ +/* $OpenBSD: misc.c,v 1.77 2021/12/15 04:01:52 deraadt Exp $ */ /* * Miscellaneous functions @@ -1135,7 +1135,7 @@ ksh_get_wd(char *buf, int bsize) /* Assume getcwd() available */ if (!buf) { bsize = PATH_MAX; - b = alloc(PATH_MAX + 1, ATEMP); + b = alloc(bsize, ATEMP); } else b = buf; |