]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
telnet: print DISPlay LOCation in printsub without mutating buffer
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Sun, 5 Oct 2025 03:07:54 +0000 (11:07 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 5 Oct 2025 12:03:31 +0000 (14:03 +0200)
Closes #18852

lib/telnet.c

index ddc0b22cb65a295f39b5cc5b2f22f7eea222b6ed..90316a446ccb335b201c4f3be06c68db16f4f496 100644 (file)
@@ -759,8 +759,8 @@ static void printsub(struct Curl_easy *data,
       switch(pointer[0]) {
       case CURL_TELOPT_TTYPE:
       case CURL_TELOPT_XDISPLOC:
-        pointer[length] = 0;
-        infof(data, " \"%s\"", &pointer[2]);
+        infof(data, " \"%.*s\"",
+              (int)((length > 2) ? (length - 2) : 0), &pointer[2]);
         break;
       case CURL_TELOPT_NEW_ENVIRON:
         if(pointer[1] == CURL_TELQUAL_IS) {