commit 7116cd8534545543e06ba9581b46c058f2dd2124
parent 36747647964a2893277d27848ee8a1d577455cf8
Author: Quentin Rameau <quinq@fifth.space>
Date: Mon, 7 Oct 2019 22:46:36 +0200
[cc] Finalize temporary buffer in path()
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c
@@ -113,8 +113,10 @@ path(char *s)
cnt += len;
}
- if (cnt != FILENAME_MAX)
+ if (cnt < FILENAME_MAX) {
+ buff[cnt] = '\0';
return xstrdup(buff);
+ }
too_long:
die("cc: too long pathname");