From ebe8c14d34d3f6957b4e44967c9089b84e144ddf Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 15 Jun 2021 01:42:21 +0200 Subject: [PATCH] udhcpc: do not use inet_addr() to parse -r REQ_IP, it's deprecated ...and we did not error-check it, and this is the only use of it: function old new delta inet_addr 37 - -37 Signed-off-by: Denys Vlasenko --- networking/udhcp/dhcpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index d67f60c00..ab9edd264 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1284,7 +1284,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) memcpy(p + OPT_DATA + 3, str_F, len); /* do not store NUL byte */ } if (opt & OPT_r) - requested_ip = inet_addr(str_r); + if (!inet_aton(str_r, (void*)&requested_ip)) + bb_show_usage(); #if ENABLE_FEATURE_UDHCP_PORT if (opt & OPT_P) { CLIENT_PORT = xatou16(str_P);