telnet: handle single-byte input option

Coverity CID 1638753 correctly identies this code misbehaved if the
passed in suboption is exactly one byte long by substracting two from
the unsigned size_t variable.

Closes #15987
This commit is contained in:
Daniel Stenberg 2025-01-13 12:16:19 +01:00
parent 81a25ba7a4
commit 02ba03938f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -695,7 +695,10 @@ static void printsub(struct Curl_easy *data,
infof(data, ", not IAC SE) ");
}
}
length -= 2;
if(length >= 2)
length -= 2;
else /* bad input */
return;
}
if(length < 1) {
infof(data, "(Empty suboption?)");