]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: fix the bsearch call for ip-tos names
authorDaniel Stenberg <daniel@haxx.se>
Wed, 12 Jun 2024 22:36:40 +0000 (00:36 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 13 Jun 2024 07:45:51 +0000 (09:45 +0200)
Follow-up to 3c20ae08b9591
Reported-by: Samuel Chiang
Fixes #13932
Closes #13933

src/tool_getparam.c

index e0d754cf123cdca4d5ecd2d63f86b35d82c68f8a..701b665d8f44dcdfff30507237c95acdc5888558 100644 (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 */