gthreadedresolver: Fix logic in parse_res_text()

and avoid a sign-compare warning.

Fixes #2209
This commit is contained in:
Peter Bloomfield 2020-09-26 11:11:44 -04:00
parent f2df054673
commit a3b5e188aa

View File

@ -620,7 +620,7 @@ parse_res_txt (guchar *answer,
while (at < end) while (at < end)
{ {
len = *(at++); len = *(at++);
if (len > at - end) if (len > (gsize) (end - at))
break; break;
g_ptr_array_add (array, g_strndup ((gchar *)at, len)); g_ptr_array_add (array, g_strndup ((gchar *)at, len));
at += len; at += len;