aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-12-31 14:40:36 +0000
committerNick Clifton <nickc@redhat.com>2009-12-31 14:40:36 +0000
commita6da20b52c17c80c5123758341d23d92b80e2fb1 (patch)
treec22f566bb48cdfe84d3db3be26cb7dd8c3dd2f32
parent0ee19663b713925ef333675f1497b482e03dc4c3 (diff)
downloadfsf-binutils-gdb-a6da20b52c17c80c5123758341d23d92b80e2fb1.zip
fsf-binutils-gdb-a6da20b52c17c80c5123758341d23d92b80e2fb1.tar.gz
fsf-binutils-gdb-a6da20b52c17c80c5123758341d23d92b80e2fb1.tar.bz2
* objcopy.c (add_redefine_syms_file): Avoid symbol buffer
overrun.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objcopy.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e0ff398..2dfa3b9 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-31 Eirik Byrkjeflot Anonsen <eirik@opera.com>
+ Nick Clifton <nickc@redhat.com>
+
+ * objcopy.c (add_redefine_syms_file): Avoid symbol buffer
+ overrun.
+
2009-12-21 Alan Modra <amodra@gmail.com>
* MAINTAINERS: Update my email address.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 20f867c..bd8dcec 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1232,7 +1232,7 @@ add_redefine_syms_file (const char *filename)
filename, strerror (errno));
bufsize = 100;
- buf = (char *) xmalloc (bufsize);
+ buf = (char *) xmalloc (bufsize + 1 /* For the terminating NUL. */);
lineno = 1;
c = getc (file);
@@ -1249,7 +1249,7 @@ add_redefine_syms_file (const char *filename)
if (len >= bufsize)
{
bufsize *= 2;
- buf = (char *) xrealloc (buf, bufsize);
+ buf = (char *) xrealloc (buf, bufsize + 1);
}
c = getc (file);
}
@@ -1275,7 +1275,7 @@ add_redefine_syms_file (const char *filename)
if (len >= bufsize)
{
bufsize *= 2;
- buf = (char *) xrealloc (buf, bufsize);
+ buf = (char *) xrealloc (buf, bufsize + 1);
}
c = getc (file);
}