summaryrefslogtreecommitdiff
path: root/lib/setopt.c
diff options
context:
space:
mode:
authorJames Keast <jkeast@blackberry.com>2023-02-10 15:24:15 -0400
committerDan Fandrich <dan@coneharvesters.com>2023-02-11 10:13:38 -0800
commit635bf5a6b2f5ff87095f4350cea6f6f4e192d14f (patch)
treef9f01966fd9e4737993068cbd40402ce343876a2 /lib/setopt.c
parent38262c944d9c86594e3915ab3a7a5e17db6107f0 (diff)
downloadcurl-635bf5a6b2f5ff87095f4350cea6f6f4e192d14f.tar.gz
setopt: Address undefined behaviour by checking for null
This addresses undefined behaviour found using clang's UBsan: curl/lib/setopt.c:177:14: runtime error: applying non-zero offset 1 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior curl/lib/setopt.c:177:14 in Closes #10472
Diffstat (limited to 'lib/setopt.c')
-rw-r--r--lib/setopt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/setopt.c b/lib/setopt.c
index b8c639847..b8fa1b89e 100644
--- a/lib/setopt.c
+++ b/lib/setopt.c
@@ -174,7 +174,7 @@ static CURLcode protocol2num(const char *str, curl_prot_t *val)
*val |= h->protocol;
}
- } while(str++);
+ } while(str && str++);
if(!*val)
/* no protocol listed */