ftp: avoid accessing EPSV response one byte past the NULL

If the response is just a single "(".

Reported-by: Andrew Nesbit
Closes #21545
This commit is contained in:
Daniel Stenberg 2026-05-11 00:18:53 +02:00
parent 67ce672842
commit 6f1dfab6a2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2073,7 +2073,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
ptr++;
/* |||12345| */
sep = ptr[0];
if((ptr[1] == sep) && (ptr[2] == sep) && ISDIGIT(ptr[3])) {
if(sep && (ptr[1] == sep) && (ptr[2] == sep) && ISDIGIT(ptr[3])) {
const char *p = &ptr[3];
curl_off_t num;
if(curlx_str_number(&p, &num, 0xffff) || (*p != sep)) {