telnet: print DISPlay LOCation in printsub without mutating buffer

Closes #18852
This commit is contained in:
Joshua Rogers 2025-10-05 11:07:54 +08:00 committed by Daniel Stenberg
parent eb88092703
commit da8f7ae096
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View 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) {