From cdb290580c0adf1dd4e1467e8d3afeaa13fa0df7 Mon Sep 17 00:00:00 2001 From: Douglas B Rupp Date: Wed, 12 Dec 2001 07:42:03 -0500 Subject: [PATCH] cppfiles.c (read_include_file): Set buffer size properly when file is shorter than expected. * cppfiles.c (read_include_file): Set buffer size properly when file is shorter than expected. From-SVN: r47931 --- gcc/ChangeLog | 5 +++++ gcc/cppfiles.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 833d2d2..c34e921 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Dec 12 07:35:24 2001 Douglas B. Rupp + + * cppfiles.c (read_include_file): Set buffer size properly when + file is shorter than expected. + Wed Dec 12 08:35:33 2001 Nicola Pero * objc/objc-act.c (encode_complete_bitfield): Fixed encoding diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 33801d6..1bd6c5a 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -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; -- 2.7.4