Commit 3a22097c authored by Eli Zaretskii's avatar Eli Zaretskii

Fix valgrind report in call-interactively

* src/callint.c (Fcall_interactively): Don't try to access more
bytes than are available in the interactive spec.  (Bug#30004)
parent d5f1c87b
......@@ -774,10 +774,23 @@ invoke it. If KEYS is omitted or nil, the return value of
if anyone tries to define one here. */
case '+':
default:
error ("Invalid control letter `%c' (#o%03o, #x%04x) in interactive calling string",
STRING_CHAR ((unsigned char *) tem),
(unsigned) STRING_CHAR ((unsigned char *) tem),
(unsigned) STRING_CHAR ((unsigned char *) tem));
{
/* How many bytes are left unprocessed in the specs string?
(Note that this excludes the trailing null byte.) */
ptrdiff_t bytes_left = SBYTES (specs) - (tem - string);
unsigned letter;
/* If we have enough bytes left to treat the sequence as a
character, show that character's codepoint; otherwise
show only its first byte. */
if (bytes_left >= BYTES_BY_CHAR_HEAD (*((unsigned char *) tem)))
letter = STRING_CHAR ((unsigned char *) tem);
else
letter = *((unsigned char *) tem);
error ("Invalid control letter `%c' (#o%03o, #x%04x) in interactive calling string",
(int) letter, letter, letter);
}
}
if (varies[i] == 0)
......
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