spoon

set dwm status
git clone git://git.2f30.org/spoon
Log | Files | Refs | LICENSE

commit 38c784dbf87e6629ec50c4c80c5ee16c834d1f42
parent 6d810a050344c349a02eeeba238ba47f57e2e987
Author: sin <sin@2f30.org>
Date:   Mon, 29 May 2017 15:34:12 +0100

Cast isprint() argument to unsigned char

The type of buf[i] is char.  On systems where char is signed it is
possible that a negative value other than EOF is passed to isprint().
This in turn invokes undefined behaviour.

Diffstat:
Mfile.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/file.c b/file.c @@ -42,7 +42,7 @@ fileread(void *arg, char *buf, size_t len) buf[n - 1] = '\0'; /* stop at the first non-printable character */ for (i = 0; i < len; i++) - if (!isprint(buf[i])) + if (!isprint((unsigned char)buf[i])) buf[i] = '\0'; return 0; }