From: Daniel Stenberg Date: Wed, 12 Jun 2024 22:36:40 +0000 (+0200) Subject: tool_getparam: fix the bsearch call for ip-tos names X-Git-Tag: curl-8_9_0~250 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=410111b515d865547778498874929049f8bc02b5;p=thirdparty%2Fcurl.git tool_getparam: fix the bsearch call for ip-tos names Follow-up to 3c20ae08b9591 Reported-by: Samuel Chiang Fixes #13932 Closes #13933 --- diff --git a/src/tool_getparam.c b/src/tool_getparam.c index e0d754cf12..701b665d8f 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -1685,9 +1685,12 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ config->tcp_nodelay = toggle; break; case C_IP_TOS: { /* --ip-tos */ - const struct TOSEntry *entry = bsearch( - &nextarg, tos_entries, sizeof(tos_entries)/sizeof(*tos_entries), - sizeof(*tos_entries), find_tos); + struct TOSEntry find; + const struct TOSEntry *entry; + find.name = nextarg; + entry = bsearch(&find, tos_entries, + sizeof(tos_entries)/sizeof(*tos_entries), + sizeof(*tos_entries), find_tos); if(entry) config->ip_tos = entry->value; else /* numeric tos value */