diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-09-07 19:00:57 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-09-07 19:00:57 +0200 |
commit | 5c5a526d0abe22cb7fc30707bd14f09d8b5d1f9c (patch) | |
tree | a6136585a4a6ab6ab4160459ee5703606b44762c /sfeed_html.c | |
parent | 04a72b9634ada77f59f409989d36cb2063d93cb4 (diff) |
fix many undefined behaviour in usage of ctype functions
- cast all ctype(3) function 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 does not, which is probably the
correct thing to interpret it.
- no need to cast for putchar + rename some fputc(..., stdout) to putchar
POSIX says:
"The fputc() function shall write the byte specified by c (converted to an
unsigned char) to the output stream pointed to by stream [...]"
Major thanks to Leonardo Taccari <iamleot@gmail.com> for reporting and testing
it on NetBSD!
Diffstat (limited to 'sfeed_html.c')
0 files changed, 0 insertions, 0 deletions