Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/sdiff sdiff: fix undefined behavior when parsing edi...



details:   https://anonhg.NetBSD.org/src/rev/a6ad432a4215
branches:  trunk
changeset: 1023142:a6ad432a4215
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 27 17:36:37 2021 +0000

description:
sdiff: fix undefined behavior when parsing edit commands

lint says: warning: argument to 'function from <ctype.h>' must be cast
to 'unsigned char', not to 'int' [342]

diffstat:

 usr.bin/sdiff/edit.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 1925251c9d5c -r a6ad432a4215 usr.bin/sdiff/edit.c
--- a/usr.bin/sdiff/edit.c      Fri Aug 27 17:35:03 2021 +0000
+++ b/usr.bin/sdiff/edit.c      Fri Aug 27 17:36:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: edit.c,v 1.4 2011/09/01 07:18:51 plunky Exp $  */
+/*     $NetBSD: edit.c,v 1.5 2021/08/27 17:36:37 rillig Exp $  */
 /*     $OpenBSD: edit.c,v 1.14 2006/05/25 03:20:32 ray Exp $ */
 
 /*
@@ -76,7 +76,7 @@
        char buf[BUFSIZ], *text;
 
        /* Skip whitespace. */
-       while (isspace((int)(*cmd)))
+       while (isspace((unsigned char)(*cmd)))
                ++cmd;
 
        text = NULL;



Home | Main Index | Thread Index | Old Index