* read.c (unescape_char): [SV 45050] Handle final backslashes.

If the last thing in the string to be unescaped is a backslash,
stop without reading beyond the end of the string.
This commit is contained in:
Paul Smith 2015-07-12 12:35:42 -04:00
parent ac9a39dad7
commit 9ef06be018

5
read.c
View File

@ -2343,6 +2343,10 @@ unescape_char (char *string, int c)
/* It's not; just take it all without unescaping. */
memmove (p, s, l);
p += l;
// If we hit the end of the string, we're done
if (*e == '\0')
break;
}
else if (l > 1)
{
@ -2351,6 +2355,7 @@ unescape_char (char *string, int c)
memmove (p, s, l);
p += l;
}
s = e;
}