libnm: fix wrong variable in route attribute validation error message

The validation checks 'addr' (the extracted address portion before '/')
but the error message prints 'string' (the full input including the
prefix). For input like "192.168.1.999/24", the error would show the
full string instead of just the invalid address part.

Found by Coverity (CID: COPY_PASTE_ERROR).

Fixes: 539db43619 ('libnm: avoid heap allocation for checking valid routes in nm_ip_route_attribute_validate()')

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit 3d4ad7b4ba)
This commit is contained in:
Jan Vaclav 2026-04-07 13:17:23 +02:00
parent 09fa1dc8b4
commit 530a8934f5

View file

@ -1401,7 +1401,7 @@ _ip_route_attribute_validate(const char *name,
NM_CONNECTION_ERROR_FAILED,
family == AF_INET ? _("'%s' is not a valid IPv4 address")
: _("'%s' is not a valid IPv6 address"),
string);
addr);
return FALSE;
}
break;