aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorDouglas B Rupp <rupp@gnat.com>2001-12-12 07:42:03 -0500
committerRichard Kenner <kenner@gcc.gnu.org>2001-12-12 07:42:03 -0500
commitcdb290580c0adf1dd4e1467e8d3afeaa13fa0df7 (patch)
treeafa504bc2aa9cc6353b08a019e263d98bbd4b953 /gcc/cppfiles.c
parenta9785c70dc7d27f1057ad53d2138110e3385608f (diff)
downloadgcc-cdb290580c0adf1dd4e1467e8d3afeaa13fa0df7.zip
gcc-cdb290580c0adf1dd4e1467e8d3afeaa13fa0df7.tar.gz
gcc-cdb290580c0adf1dd4e1467e8d3afeaa13fa0df7.tar.bz2
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
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c5
1 files changed, 3 insertions, 2 deletions
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;