Commit 5e031029 authored by Thomas Roessler's avatar Thomas Roessler

Avoid reading past the end of ta string when handling \ or ^

sequences.  From Michael Elkins.
parent 8c20079f
......@@ -135,10 +135,14 @@ int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags)
qc = ch;
else if (ch == '\\' && qc != '\'')
{
if (!*tok->dptr)
return -1; /* premature end of token */
switch (ch = *tok->dptr++)
{
case 'c':
case 'C':
if (!*tok->dptr)
return -1; /* premature end of token */
mutt_buffer_addch (dest, (toupper (*tok->dptr) - '@') & 0x7f);
tok->dptr++;
break;
......@@ -172,6 +176,8 @@ int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags)
}
else if (ch == '^' && (flags & M_TOKEN_CONDENSE))
{
if (!*tok->dptr)
return -1; /* premature end of token */
ch = *tok->dptr++;
if (ch == '^')
mutt_buffer_addch (dest, ch);
......
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