* xsmfns.c (smc_save_yourself_CB): Check for size calc overflow.
This commit is contained in:
parent
864d7ce76d
commit
1d526e2f33
2 changed files with 5 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
2011-07-29 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* xsmfns.c (smc_save_yourself_CB): Check for size calc overflow.
|
||||
|
||||
* xselect.c: Integer and memory overflow issues.
|
||||
(X_LONG_SIZE, X_USHRT_MAX, X_ULONG_MAX): New macros.
|
||||
Use them to make the following changes clearer.
|
||||
|
|
|
@ -223,6 +223,9 @@ smc_save_yourself_CB (SmcConn smcConn,
|
|||
props[props_idx]->name = xstrdup (SmRestartCommand);
|
||||
props[props_idx]->type = xstrdup (SmLISTofARRAY8);
|
||||
/* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */
|
||||
if (min (INT_MAX, min (PTRDIFF_MAX, SIZE_MAX) / sizeof *vp) - 3
|
||||
< initial_argc)
|
||||
memory_full (SIZE_MAX);
|
||||
i = 3 + initial_argc;
|
||||
props[props_idx]->num_vals = i;
|
||||
vp = (SmPropValue *) xmalloc (i * sizeof(*vp));
|
||||
|
|
Loading…
Add table
Reference in a new issue