]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* objcopy.c (add_redefine_syms_file): Avoid symbol buffer
authorNick Clifton <nickc@redhat.com>
Thu, 31 Dec 2009 14:43:49 +0000 (14:43 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 31 Dec 2009 14:43:49 +0000 (14:43 +0000)
        overrun.

binutils/ChangeLog
binutils/objcopy.c

index 0cb11af9e226f792d9d3fc8a65b4b5342fb9bfc1..21006a6c9206848cff44b9b58542632398754cea 100644 (file)
@@ -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-10-23  Thomas Cougnard  <thomas.cougnard@gmail.com>
 
        * readelf.c (dynamic_info): Correct size of array.
index 2048827f8e17f21d9bdf06545466247f7b2b1fc2..e0cac197f1ff9c15e104f31422a34a643d221a2f 100644 (file)
@@ -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);
        }