Fix paranoia guard in literal string alloc

This commit is contained in:
Landon Curt Noll
2021-11-30 03:44:38 -08:00
parent f3adb35e36
commit eb940e0a21

2
str.c
View File

@@ -316,7 +316,7 @@ addliteral(char *str)
math_error("Cannot allocate large literal string");
/*NOTREACHED*/
}
table[len] = '\0'; /* guard paranoia */
newstr[len] = '\0'; /* guard paranoia */
strlcpy(newstr, str, len);
table[literals.l_count++] = newstr;
return newstr;