Fix problems detected by -fsanitize=address

This commit is contained in:
matt335672
2024-05-07 12:01:50 +01:00
parent 67ace5c59d
commit 4e77772ea2
3 changed files with 11 additions and 3 deletions
+8 -1
View File
@@ -345,7 +345,14 @@ int
split_string_append_fragment(const char **start, const char *end,
struct list *list)
{
const unsigned int len = end - *start;
unsigned int len = end - *start;
// Check for an unexpected terminator in the string
const char *term = (const char *)memchr(*start, '\0', len);
if (term != NULL)
{
end = term;
len = end - *start;
}
char *copy = (char *)malloc(len + 1);
if (copy == NULL)
{