append_yylval_tzString should always evaluate its argument

Fixes #762
This commit is contained in:
Rangi
2021-02-23 23:25:58 -05:00
committed by Rangi
parent 1f579deaff
commit 63d15ac8c9
4 changed files with 28 additions and 2 deletions

View File

@@ -1455,15 +1455,16 @@ static char const *readInterpolation(void)
}
#define append_yylval_tzString(c) do { \
char v = (c); /* Evaluate c exactly once in case it has side effects. */ \
if (i < sizeof(yylval.tzString)) \
yylval.tzString[i++] = (c); \
yylval.tzString[i++] = v; \
} while (0)
static size_t appendEscapedSubstring(char const *str, size_t i)
{
/* Copy one extra to flag overflow */
while (*str) {
int c = *str++;
char c = *str++;
/* Escape characters that need escaping */
switch (c) {