shithub: scc

Download patch

ref: 7116cd8534545543e06ba9581b46c058f2dd2124
parent: 36747647964a2893277d27848ee8a1d577455cf8
author: Quentin Rameau <quinq@fifth.space>
date: Mon Oct 7 18:46:36 EDT 2019

[cc] Finalize temporary buffer in path()

--- a/src/cmd/cc/posix/cc.c
+++ b/src/cmd/cc/posix/cc.c
@@ -113,8 +113,10 @@
 		cnt += len;
 	}
 
-	if (cnt != FILENAME_MAX)
+	if (cnt < FILENAME_MAX) {
+		buff[cnt] = '\0';
 		return xstrdup(buff);
+	}
 
 too_long:
 	die("cc: too long pathname");