summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-06-05 23:16:12 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-06-05 23:16:12 -0700
commitd1f3d2afe1057a99b9dec6d1bd5b57bfee81fdff (patch)
treef471bdf3143b2d4ba0cf2d4c4e530304b7a67c88 /src/fileio.c
parentdd52fcea063f37a9875bf9196dbe11a442e8adfc (diff)
downloademacs-d1f3d2afe1057a99b9dec6d1bd5b57bfee81fdff.tar.gz
emacs-d1f3d2afe1057a99b9dec6d1bd5b57bfee81fdff.tar.bz2
emacs-d1f3d2afe1057a99b9dec6d1bd5b57bfee81fdff.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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 48dac80a39f..82b31036fb9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3248,7 +3248,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
/* Check whether the size is too large or negative, which can happen on a
platform that allows file sizes greater than the maximum off_t value. */
if (! not_regular
- && ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM))
+ && ! (0 <= st.st_size && st.st_size <= BUF_BYTES_MAX))
error ("Maximum buffer size exceeded");
/* Prevent redisplay optimizations. */