← Commit list

172e190c79

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

Subject

ftp: add extra buffer length check

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+4 -3
@@ -479,13 +479,14 @@ static CURLcode ftp_check_ctrl_on_data_wait(struct Curl_easy *data,
infof(data, "Ctrl conn has data while waiting for data conn");
if(pp->overflow > 3) {
const char *r = curlx_dyn_ptr(&pp->recvbuf);
+ size_t len = curlx_dyn_len(&pp->recvbuf);
- DEBUGASSERT((pp->overflow + pp->nfinal) <=
- curlx_dyn_len(&pp->recvbuf));
+ DEBUGASSERT((pp->overflow + pp->nfinal) <= curlx_dyn_len(&pp->recvbuf));
/* move over the most recently handled response line */
r += pp->nfinal;
+ len -= pp->nfinal;
- if(LASTLINE(r)) {
+ if((len > 3) && LASTLINE(r)) {
curl_off_t status;
if(!curlx_str_number(&r, &status, 999) && (status == 226)) {
/* funny timing situation where we get the final message on the