nss-resolve: accept zero ifindex when parsing resolved reply
Sometimes a reply isn't associated to any specific interface, it might be a general truth (for example served from /etc/hosts or so). In this case the server might pass ifindex == 0. Accept that. https://github.com/systemd/systemd/pull/17823#issuecomment-742439422
This commit is contained in:
@@ -90,7 +90,7 @@ static int json_dispatch_ifindex(const char *name, JsonVariant *variant, JsonDis
|
||||
return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not an integer.", strna(name));
|
||||
|
||||
t = json_variant_integer(variant);
|
||||
if (t <= 0 || t > INT_MAX)
|
||||
if (t > INT_MAX)
|
||||
return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is out of bounds for an interface index.", strna(name));
|
||||
|
||||
*ifi = (int) t;
|
||||
|
||||
Reference in New Issue
Block a user