Commit 1d526e2f authored by Paul Eggert's avatar Paul Eggert
Browse files

* xsmfns.c (smc_save_yourself_CB): Check for size calc overflow.

parent 864d7ce7
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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment