1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 23:10:47 -08:00

* process.c (Fnetwork_interface_list): Check for overflow

in size calculation.
This commit is contained in:
Paul Eggert 2011-07-28 18:05:39 -07:00
parent 1ef7689b97
commit bf2da747e9
2 changed files with 9 additions and 0 deletions

View file

@ -1,5 +1,8 @@
2011-07-29 Paul Eggert <eggert@cs.ucla.edu>
* process.c (Fnetwork_interface_list): Check for overflow
in size calculation.
* nsterm.h (struct ns_color_table.size, struct ns_color_table.avail):
Now ptrdiff_t, not int.
* nsterm.m (ns_index_color): Use ptrdiff_t, not int, for table indexes.

View file

@ -3567,6 +3567,12 @@ format; see the description of ADDRESS in `make-network-process'. */)
return Qnil;
again:
if (min (INT_MAX, min (PTRDIFF_MAX, SIZE_MAX)) / sizeof *ifreqs - 25
< ifaces)
{
xfree (ifreqs);
memory_full (SIZE_MAX);
}
ifaces += 25;
buf_size = ifaces * sizeof (ifreqs[0]);
ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size);