telnet: ignore empty suboptions

To avoid printing from en empty buffer

Reported-by: Joshua Rogers
Closes #18899
This commit is contained in:
Daniel Stenberg 2025-10-06 23:05:10 +02:00
parent 3660e6da80
commit 33380fa214
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -947,6 +947,9 @@ static CURLcode suboption(struct Curl_easy *data, struct TELNET *tn)
int err;
struct connectdata *conn = data->conn;
if(!CURL_SB_LEN(tn)) /* ignore empty suboption */
return CURLE_OK;
printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2);
switch(CURL_SB_GET(tn)) {
case CURL_TELOPT_TTYPE: