diff options
| author | Paul Eggert | 2011-07-28 18:05:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-28 18:05:39 -0700 |
| commit | bf2da747e95a3902bf715076aeee947d657c94cd (patch) | |
| tree | ca8f9968080561a670b145d1e7fa433be0d84e8a | |
| parent | 1ef7689b9784baa31d1d723909d226fddd95bc86 (diff) | |
| download | emacs-bf2da747e95a3902bf715076aeee947d657c94cd.tar.gz emacs-bf2da747e95a3902bf715076aeee947d657c94cd.zip | |
* process.c (Fnetwork_interface_list): Check for overflow
in size calculation.
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/process.c | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 748ccc333b2..46d2cdb82f7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-07-29 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-07-29 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * process.c (Fnetwork_interface_list): Check for overflow | ||
| 4 | in size calculation. | ||
| 5 | |||
| 3 | * nsterm.h (struct ns_color_table.size, struct ns_color_table.avail): | 6 | * nsterm.h (struct ns_color_table.size, struct ns_color_table.avail): |
| 4 | Now ptrdiff_t, not int. | 7 | Now ptrdiff_t, not int. |
| 5 | * nsterm.m (ns_index_color): Use ptrdiff_t, not int, for table indexes. | 8 | * nsterm.m (ns_index_color): Use ptrdiff_t, not int, for table indexes. |
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'. */) | |||
| 3567 | return Qnil; | 3567 | return Qnil; |
| 3568 | 3568 | ||
| 3569 | again: | 3569 | again: |
| 3570 | if (min (INT_MAX, min (PTRDIFF_MAX, SIZE_MAX)) / sizeof *ifreqs - 25 | ||
| 3571 | < ifaces) | ||
| 3572 | { | ||
| 3573 | xfree (ifreqs); | ||
| 3574 | memory_full (SIZE_MAX); | ||
| 3575 | } | ||
| 3570 | ifaces += 25; | 3576 | ifaces += 25; |
| 3571 | buf_size = ifaces * sizeof (ifreqs[0]); | 3577 | buf_size = ifaces * sizeof (ifreqs[0]); |
| 3572 | ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size); | 3578 | ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size); |