aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2013-07-19 10:54:26 -0700
committerPaul Eggert2013-07-19 10:54:26 -0700
commit4195afc389bb0e5ed5aa749e7606a710e07a72d1 (patch)
tree60dfc46ed7b1cc06d36faaa291ec0ae3fb020843 /src/alloc.c
parenta1aeeffedd3b05a33bdd73737651debbda00cf5f (diff)
downloademacs-4195afc389bb0e5ed5aa749e7606a710e07a72d1.tar.gz
emacs-4195afc389bb0e5ed5aa749e7606a710e07a72d1.zip
* alloc.c (staticpro): Avoid buffer overrun on repeated calls.
(NSTATICS): Now a constant; doesn't need to be a macro.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 11245741bd5..4c924f72384 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -341,7 +341,7 @@ struct gcpro *gcprolist;
341/* Addresses of staticpro'd variables. Initialize it to a nonzero 341/* Addresses of staticpro'd variables. Initialize it to a nonzero
342 value; otherwise some compilers put it into BSS. */ 342 value; otherwise some compilers put it into BSS. */
343 343
344#define NSTATICS 0x800 344enum { NSTATICS = 2048 };
345static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; 345static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag};
346 346
347/* Index of next unused slot in staticvec. */ 347/* Index of next unused slot in staticvec. */
@@ -5136,9 +5136,9 @@ Does not copy symbols. Copies strings without text properties. */)
5136void 5136void
5137staticpro (Lisp_Object *varaddress) 5137staticpro (Lisp_Object *varaddress)
5138{ 5138{
5139 staticvec[staticidx++] = varaddress;
5140 if (staticidx >= NSTATICS) 5139 if (staticidx >= NSTATICS)
5141 fatal ("NSTATICS too small; try increasing and recompiling Emacs."); 5140 fatal ("NSTATICS too small; try increasing and recompiling Emacs.");
5141 staticvec[staticidx++] = varaddress;
5142} 5142}
5143 5143
5144 5144