[PATCH 1/1] net: consider option-length when parsing NIS domain

When parsing option 40 (network information service domain) the option length is in variable 'oplen' and not in 'size'.
Addresses-Coverity-ID: 492765 Uninitialized variables (UNINIT) Fixes: 8ab388bfdbcf ("net: add support to parse the NIS domain for the dhcp options") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- net/bootp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bootp.c b/net/bootp.c index c15472f5d37..86c56803c76 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -886,7 +886,7 @@ static void dhcp_process_options(uchar *popt, uchar *end) case 40: /* NIS Domain name */ if (net_nis_domain[0] == 0) { size = truncate_sz("NIS Domain Name", - sizeof(net_nis_domain), size); + sizeof(net_nis_domain), oplen); memcpy(&net_nis_domain, popt + 2, size); net_nis_domain[size] = 0; }

On Tue, Apr 23, 2024 at 09:09:44AM +0200, Heinrich Schuchardt wrote:
When parsing option 40 (network information service domain) the option length is in variable 'oplen' and not in 'size'.
Addresses-Coverity-ID: 492765 Uninitialized variables (UNINIT) Fixes: 8ab388bfdbcf ("net: add support to parse the NIS domain for the dhcp options") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
Applied to u-boot/master, thanks!
participants (2)
-
Heinrich Schuchardt
-
Tom Rini