[MOD] Add basic length checking

This commit is contained in:
lda 2023-12-08 21:24:31 +01:00
parent 2a61df37ad
commit 88c9d10f90

View file

@ -196,6 +196,7 @@ ParseIPv6(char **str, char **out)
length += strlen(ipv4);
Free(ipv4);
c = Iterate(str);
filled = 1;
goto end;
}
}
@ -207,7 +208,12 @@ end:
}
length = (size_t) (*str - start);
if (length < 4 || length > 47)
{
goto fail;
}
*out = Malloc(length + 1);
memset(*out, '\0', length + 1);
memcpy(*out, start, length);
return 1;