]> git.armaanb.net Git - sic.git/commit
fix undefined behaviour of using isspace ctype function
authorHiltjo Posthuma <hiltjo@codemadness.org>
Wed, 5 May 2021 23:09:21 +0000 (01:09 +0200)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Wed, 5 May 2021 23:09:21 +0000 (01:09 +0200)
commitd9bda20849c464eff0adb56414da1840abc6ef6a
treed1daa39f86f7faaa474b7a48751fd495431fcc68
parentdf4c0611366bf361fa263fbc57009cbe68456855
fix undefined behaviour of using isspace ctype function

cast all ctype(3) functions argument to (unsigned char) to avoid UB

POSIX says:
"The c argument is an int, the value of which the application shall ensure is a
character representable as an unsigned char or equal to the value of the macro
EOF. If the argument has any other value, the behavior is undefined."

Many libc cast implicitly the value, but NetBSD for example does not, which is
probably the correct thing to interpret it.
sic.c
util.c