diff options
author | Nick Clifton <nickc@redhat.com> | 2009-12-31 14:40:36 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-12-31 14:40:36 +0000 |
commit | 222281c9a7e2bf58c0b2d8960db308d8c24db143 (patch) | |
tree | 4c55fe8e46b697b5c9a8ae8fc62bde48a174a6c5 /binutils/objcopy.c | |
parent | 7b5bc0cfef0553f34b9e2f4b8a42b37366bc708c (diff) | |
download | binutils-redhat-222281c9a7e2bf58c0b2d8960db308d8c24db143.tar.gz |
* objcopy.c (add_redefine_syms_file): Avoid symbol buffer
overrun.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 20f867c01f..bd8dcec833 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); } |