summaryrefslogtreecommitdiff
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
parent9903cda2a734c2f86eefcff656aad032fbb79078 (diff)
downloadgunmake-df2fa7c5a5726b4e0a50e0eff209a3518ab19603.tar.gz
Fix buffer overrun in concat().
-rw-r--r--ChangeLog4
-rw-r--r--misc.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 12ef1c4..a4d0600 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-16 Boris Kolpackov <boris@codesynthesis.com>
+
+ * misc.c (concat): Fix buffer overrun.
+
2010-07-12 Paul Smith <psmith@gnu.org>
Update copyrights to add 2010.
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;