summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@kolpackov.net>2010-07-16 13:01:15 +0000
committerBoris Kolpackov <boris@kolpackov.net>2010-07-16 13:01:15 +0000
commitdf2fa7c5a5726b4e0a50e0eff209a3518ab19603 (patch)
treeac51e42a10aa1720b5f86d31d6f8f543bceeffc0 /misc.c
parent9903cda2a734c2f86eefcff656aad032fbb79078 (diff)
downloadgunmake-df2fa7c5a5726b4e0a50e0eff209a3518ab19603.tar.gz
Fix buffer overrun in concat().
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index f4806ac..39c2835 100644
--- a/misc.c
+++ b/misc.c
@@ -202,6 +202,14 @@ concat (num, va_alist)
VA_END (args);
+ /* Get some more memory if we don't have enough space for the
+ terminating '\0'. */
+ if (ri == rlen)
+ {
+ rlen = (rlen ? rlen : 60) * 2;
+ result = xrealloc (result, rlen);
+ }
+
result[ri] = '\0';
return result;