tool_getparam: fix the bsearch call for ip-tos names

Follow-up to 3c20ae08b9
Reported-by: Samuel Chiang
Fixes #13932
Closes #13933
This commit is contained in:
Daniel Stenberg 2024-06-13 00:36:40 +02:00
parent 267c3b31e9
commit 410111b515
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -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 */