From: Nick Clifton Date: Thu, 31 Dec 2009 14:43:49 +0000 (+0000) Subject: * objcopy.c (add_redefine_syms_file): Avoid symbol buffer X-Git-Tag: binutils-2_20_1~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f472f66ea00e8f9eedec227d06cbd2f2676de8ec;p=thirdparty%2Fbinutils-gdb.git * objcopy.c (add_redefine_syms_file): Avoid symbol buffer overrun. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0cb11af9e22..21006a6c920 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2009-12-31 Eirik Byrkjeflot Anonsen + Nick Clifton + + * objcopy.c (add_redefine_syms_file): Avoid symbol buffer + overrun. + 2009-10-23 Thomas Cougnard * readelf.c (dynamic_info): Correct size of array. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 2048827f8e1..e0cac197f1f 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1237,7 +1237,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); @@ -1254,7 +1254,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); } @@ -1280,7 +1280,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); }