Skip to content

Commit

Permalink
telnet: handle single-byte input option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bagder committed Jan 13, 2025
1 parent 81a25ba commit 02ba039
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/telnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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?)");
Expand Down

0 comments on commit 02ba039

Please sign in to comment.