ogs_fqdn_parse: Write the terminating NULL byte even if the APN is empty

Enter the while loop even if length == 1 (with len being 0) so that the
terminating NULL byte is written to dst.
This commit is contained in:
Daniel Willmann 2024-08-20 17:45:08 +02:00 committed by Sukchan Lee
parent 591f0a2fca
commit 28f9de4b41

View file

@ -416,7 +416,7 @@ int ogs_fqdn_parse(char *dst, const char *src, int length)
int i = 0, j = 0;
uint8_t len = 0;
while (i+1 < length) {
while (i+1 <= length) {
len = src[i++];
if ((j + len + 1) > length) {
ogs_error("Invalid FQDN encoding[j:%d+len:%d] + 1 > length[%d]",