diff options
| author | Paul Eggert | 2011-06-03 19:49:51 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-03 19:49:51 -0700 |
| commit | edaa182249601b0f7ee36f9863243b6919943982 (patch) | |
| tree | 1e399289df34c433f0471efdfb8a6da4ab05ac25 /src/fileio.c | |
| parent | c6c3615fb23e438701da089110b645fc771f8087 (diff) | |
| download | emacs-edaa182249601b0f7ee36f9863243b6919943982.tar.gz emacs-edaa182249601b0f7ee36f9863243b6919943982.zip | |
Check for buffer and string overflow more precisely.
* buffer.h (BUF_BYTES_MAX): New macro.
* lisp.h (STRING_BYTES_MAX): New macro.
* alloc.c (Fmake_string):
* character.c (string_escape_byte8):
* coding.c (coding_alloc_by_realloc):
* doprnt.c (doprnt):
* editfns.c (Fformat):
* eval.c (verror):
Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
since they may not be the same number.
* editfns.c (Finsert_char):
* fileio.c (Finsert_file_contents):
Likewise for BUF_BYTES_MAX.
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index 2f7716d5b54..d9bc28d8c37 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3248,7 +3248,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3248 | /* Check whether the size is too large or negative, which can happen on a | 3248 | /* Check whether the size is too large or negative, which can happen on a |
| 3249 | platform that allows file sizes greater than the maximum off_t value. */ | 3249 | platform that allows file sizes greater than the maximum off_t value. */ |
| 3250 | if (! not_regular | 3250 | if (! not_regular |
| 3251 | && ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM)) | 3251 | && ! (0 <= st.st_size && st.st_size <= BUF_BYTES_MAX)) |
| 3252 | error ("Maximum buffer size exceeded"); | 3252 | error ("Maximum buffer size exceeded"); |
| 3253 | 3253 | ||
| 3254 | /* Prevent redisplay optimizations. */ | 3254 | /* Prevent redisplay optimizations. */ |