]> git.eshelyaron.com Git - emacs.git/commitdiff
sprintf-related integer and memory overflow issues
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Sep 2011 21:52:59 +0000 (14:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Sep 2011 21:52:59 +0000 (14:52 -0700)
Fixes: debbugs:9397 debbugs:9412
1  2 
ChangeLog
lib-src/ChangeLog
nt/ChangeLog

diff --cc ChangeLog
index 1f38dbf71ca4b9becc35838ff47fbdc9031f750e,c973a82e8a47003bed9cc57885c3fc7c7d85bce8..aae3e190049ab05912dc39dec5c02da918032e49
+++ b/ChangeLog
@@@ -1,3 -1,7 +1,7 @@@
 -2011-08-31  Paul Eggert  <eggert@cs.ucla.edu>
++2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>
+       * configure.in (snprintf): New check.
  2011-08-30  Paul Eggert  <eggert@cs.ucla.edu>
  
        * configure.in (opsys): Change pattern to *-*-linux*
index c878d313b703d6e03fd734133e290675db8d0f24,e8a0b13f4190ddb07c0ef73f6be1084b801817cd..9041eae8bbe3da72d0c137d3d328a2af8ff7f2d3
@@@ -1,3 -1,38 +1,38 @@@
 -2011-08-28  Paul Eggert  <eggert@cs.ucla.edu>
++2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>
+       Integer and memory overflow issues (Bug#9397).
+       * emacsclient.c (xmalloc): Accept size_t, not unsigned int, to
+       avoid potential buffer overflow issues on typical 64-bit hosts.
+       Return void *, not long *.
+       (get_current_dir_name): Report a failure, instead of looping
+       forever, if buffer size calculation overflows.  Treat malloc
+       failures like realloc failures, as that has better behavior and is
+       more consistent.  Do not check whether xmalloc returns NULL, as
+       that's not possible.
+       (message): Do not arbitrarily truncate message to 2048 bytes when
+       sending it to stderr; use vfprintf instead.
+       (get_server_config, set_local_socket)
+       (start_daemon_and_retry_set_socket): Do not alloca
+       arbitrarily-large buffers; that's not safe.
+       (get_server_config, set_local_socket): Do not use sprintf when its
+       result might not fit in 'int'.
+       (set_local_socket): Do not assume uid fits in 'int'.
+       * etags.c (xmalloc, xrealloc): Accept size_t, not unsigned int,
+       to avoid potential buffer overflow issues on typical 64-bit hosts.
+       (whatlen_max): New static var.
+       (main): Avoid buffer overflow if subsidiary command length is
+       greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its
+       result might not fit in 'int'.
+       * movemail.c (main): Do not use sprintf when its result might not fit
+       in 'int'.  Instead, put the possibly-long file name into the
+       output of pfatal_with_name.
+       * update-game-score.c: Include <limits.h>
+       (get_user_id): Do not assume uid fits in 'int'.  Simplify.
  2011-07-28  Paul Eggert  <eggert@cs.ucla.edu>
  
        Assume freestanding C89 headers, string.h, stdlib.h.
diff --cc nt/ChangeLog
index edbd1a1c1d431c9176051e3cdf83633004429606,f3c57c7e0d031edd8f8b5a0c957b82d69bb15e1b..8c2ca056aa12104f9a9b6b079bb9bad50a16e43d
@@@ -1,3 -1,7 +1,7 @@@
 -2011-08-31  Paul Eggert  <eggert@cs.ucla.edu>
++2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>
+       * config.nt (HAVE_SNPRINTF): New macro.
  2011-07-28  Paul Eggert  <eggert@cs.ucla.edu>
  
        Assume freestanding C89 headers, string.h, stdlib.h.