From: Mattias EngdegÄrd Date: Tue, 30 Aug 2022 09:57:29 +0000 (+0200) Subject: ; * src/lread.c (invalid_radix_integer): Use a local buffer. X-Git-Tag: emacs-29.0.90~1856^2~828 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5cf7b1ada96c2e209580d086d15b1bbe5b345657;p=emacs.git ; * src/lread.c (invalid_radix_integer): Use a local buffer. --- diff --git a/src/lread.c b/src/lread.c index bb376064811..d64a4fad3af 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2905,20 +2905,18 @@ digit_to_number (int character, int base) return digit < base ? digit : -1; } -/* Size of the fixed-size buffer used during reading. - It should be at least big enough for `invalid_radix_integer' but - can usefully be much bigger than that. */ -enum { stackbufsize = 1024 }; - static void -invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)], - Lisp_Object readcharfun) +invalid_radix_integer (EMACS_INT radix, Lisp_Object readcharfun) { - int n = snprintf (stackbuf, stackbufsize, "integer, radix %"pI"d", radix); - eassert (n < stackbufsize); - invalid_syntax (stackbuf, readcharfun); + char buf[64]; + int n = snprintf (buf, sizeof buf, "integer, radix %"pI"d", radix); + eassert (n < sizeof buf); + invalid_syntax (buf, readcharfun); } +/* Size of the fixed-size buffer used during reading. */ +enum { stackbufsize = 1024 }; + /* Read an integer in radix RADIX using READCHARFUN to read characters. RADIX must be in the interval [2..36]. Use STACKBUF for temporary storage as needed. Value is the integer read. @@ -2976,7 +2974,7 @@ read_integer (Lisp_Object readcharfun, int radix, UNREAD (c); if (valid != 1) - invalid_radix_integer (radix, stackbuf, readcharfun); + invalid_radix_integer (radix, readcharfun); *p = '\0'; return unbind_to (count, string_to_number (read_buffer, radix, NULL)); @@ -3989,7 +3987,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms) { /* #NrDIGITS -- radix-N number */ if (n < 0 || n > 36) - invalid_radix_integer (n, stackbuf, readcharfun); + invalid_radix_integer (n, readcharfun); obj = read_integer (readcharfun, n, stackbuf); break; }