Skip to content
Snippets Groups Projects
Commit 51b73ac0 authored by Tobias Stoeckmann's avatar Tobias Stoeckmann
Browse files

Protect against overly long strings


Checking against upper limit of USHRT_MAX must happen before truncating
size_t to int. On 64 bit systems with strings larger than 2 GB this
could otherwise lead to negative ints or ints smaller than USHRT_MAX.

In XParseColor this could lead to out of boundary access with strings
starting with a # (color sequence). A modulo 12 operation is performed
to validate the string length, but with an overflown length, the for
loop would eventually read behind terminating '\0' character.

Signed-off-by: default avatarTobias Stoeckmann <tobias@stoeckmann.org>
parent ab2f5953
No related branches found
No related tags found
Loading
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment