← Commit list

684af00181

Daniel Stenberg
Daniel Stenberg
2025-11-07
SUCCESS Duration: 143s

Subject

setopt: when setting bad protocols, don't store them

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/setopt.c+18 -8
@@ -2361,17 +2361,27 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
#endif /* USE_LIBSSH2 */
#endif /* USE_SSH */
case CURLOPT_PROTOCOLS_STR:
- if(ptr)
- return protocol2num(ptr, &s->allowed_protocols);
- /* make a NULL argument reset to default */
- s->allowed_protocols = (curl_prot_t) CURLPROTO_ALL;
+ if(ptr) {
+ curl_prot_t protos;
+ result = protocol2num(ptr, &protos);
+ if(!result)
+ s->allowed_protocols = protos;
+ }
+ else
+ /* make a NULL argument reset to default */
+ s->allowed_protocols = (curl_prot_t) CURLPROTO_ALL;
break;
case CURLOPT_REDIR_PROTOCOLS_STR:
- if(ptr)
- return protocol2num(ptr, &s->redir_protocols);
- /* make a NULL argument reset to default */
- s->redir_protocols = (curl_prot_t) CURLPROTO_REDIR;
+ if(ptr) {
+ curl_prot_t protos;
+ result = protocol2num(ptr, &protos);
+ if(!result)
+ s->redir_protocols = protos;
+ }
+ else
+ /* make a NULL argument reset to default */
+ s->redir_protocols = (curl_prot_t) CURLPROTO_REDIR;
break;
case CURLOPT_DEFAULT_PROTOCOL: