Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/sockstat sockstat: fix undefined behavior when calli...



details:   https://anonhg.NetBSD.org/src/rev/48b8f2c868ca
branches:  trunk
changeset: 985472:48b8f2c868ca
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 27 18:09:30 2021 +0000

description:
sockstat: fix undefined behavior when calling ctype functions

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

diffstat:

 usr.bin/sockstat/sockstat.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 465c226d4a6f -r 48b8f2c868ca usr.bin/sockstat/sockstat.c
--- a/usr.bin/sockstat/sockstat.c       Fri Aug 27 17:59:46 2021 +0000
+++ b/usr.bin/sockstat/sockstat.c       Fri Aug 27 18:09:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sockstat.c,v 1.23 2020/08/26 22:57:55 christos Exp $ */
+/*     $NetBSD: sockstat.c,v 1.24 2021/08/27 18:09:30 rillig Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sockstat.c,v 1.23 2020/08/26 22:57:55 christos Exp $");
+__RCSID("$NetBSD: sockstat.c,v 1.24 2021/08/27 18:09:30 rillig Exp $");
 #endif
 
 #define _KMEMUSER
@@ -275,7 +275,7 @@
        long x;
        char *t;
 
-       while (isdigit((u_int)**e))
+       while (isdigit((unsigned char)**e))
                (*e)++;
        if (*s != *e) {
                errno = 0;



Home | Main Index | Thread Index | Old Index