summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-28 18:05:39 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-28 18:05:39 -0700
commitbf2da747e95a3902bf715076aeee947d657c94cd (patch)
treeca8f9968080561a670b145d1e7fa433be0d84e8a /src/process.c
parent1ef7689b9784baa31d1d723909d226fddd95bc86 (diff)
* process.c (Fnetwork_interface_list): Check for overflow
in size calculation.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c
index 236c27e5c3a..31359a1f1f2 100644
--- a/src/process.c
+++ b/src/process.c
@@ -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);