cppfiles.c (read_include_file): Set buffer size properly when file is shorter than...
authorDouglas B Rupp <rupp@gnat.com>
Wed, 12 Dec 2001 12:42:03 +0000 (07:42 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 12 Dec 2001 12:42:03 +0000 (07:42 -0500)
* cppfiles.c (read_include_file): Set buffer size properly when
file is shorter than expected.

From-SVN: r47931

gcc/ChangeLog
gcc/cppfiles.c

index 833d2d268a1ef67ec0dcb0db91f9a33004d1bc84..c34e921cb87b4457146bfd53880f6903c4b229ad 100644 (file)
@@ -1,3 +1,8 @@
+Wed Dec 12 07:35:24 2001  Douglas B. Rupp  <rupp@gnat.com>
+
+       * cppfiles.c (read_include_file): Set buffer size properly when
+       file is shorter than expected.
+
 Wed Dec 12 08:35:33 2001  Nicola Pero  <n.pero@mi.flashnet.it>
 
        * objc/objc-act.c (encode_complete_bitfield): Fixed encoding
index 33801d610a64463b7ad835440c03dac85b9c29af..1bd6c5a0891439c54c7fe2039e3f1441c7a9e3fd 100644 (file)
@@ -413,8 +413,9 @@ read_include_file (pfile, inc)
                  if (!STAT_SIZE_TOO_BIG (inc->st))
                    cpp_warning
                      (pfile, "%s is shorter than expected", inc->name);
-                 buf = xrealloc (buf, offset);
-                 inc->st.st_size = offset;
+                 size = offset;
+                 buf = xrealloc (buf, size + 1);
+                 inc->st.st_size = size;
                  break;
                }
              offset += count;