]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
telnet: ignore empty suboptions
authorDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 21:05:10 +0000 (23:05 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 21:54:01 +0000 (23:54 +0200)
To avoid printing from en empty buffer

Reported-by: Joshua Rogers
Closes #18899

lib/telnet.c

index 6eb60706c98075ea60d8fb7f9680be63c73cbadb..5c25bc2eaa36a8a8028ba130e89b5f283e04001c 100644 (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: