diff options
author | James Keast <jkeast@blackberry.com> | 2023-02-10 15:24:15 -0400 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2023-02-11 10:13:38 -0800 |
commit | 635bf5a6b2f5ff87095f4350cea6f6f4e192d14f (patch) | |
tree | f9f01966fd9e4737993068cbd40402ce343876a2 /lib/setopt.c | |
parent | 38262c944d9c86594e3915ab3a7a5e17db6107f0 (diff) | |
download | curl-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.c | 2 |
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 */ |