← Commit list

6ef4871f5d

Daniel Stenberg
Daniel Stenberg
2025-10-06
SUCCESS Duration: 172s

Subject

ftp: improve fragile check for first digit > 3

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/ftp.c+8 -5
@@ -449,11 +449,14 @@ static CURLcode ftp_check_ctrl_on_data_wait(struct Curl_easy *data,
bool response = FALSE;
/* First check whether there is a cached response from server */
- if(curlx_dyn_len(&pp->recvbuf) && (*curlx_dyn_ptr(&pp->recvbuf) > '3')) {
- /* Data connection could not be established, let's return */
- infof(data, "There is negative response in cache while serv connect");
- (void)getftpresponse(data, &nread, &ftpcode);
- return CURLE_FTP_ACCEPT_FAILED;
+ if(curlx_dyn_len(&pp->recvbuf)) {
+ const char *l = curlx_dyn_ptr(&pp->recvbuf);
+ if(!ISDIGIT(*l) || (*l > '3')) {
+ /* Data connection could not be established, let's return */
+ infof(data, "There is negative response in cache while serv connect");
+ (void)getftpresponse(data, &nread, &ftpcode);
+ return CURLE_FTP_ACCEPT_FAILED;
+ }
}
if(pp->overflow)