svn commit: r254486 - head/usr.sbin/rwhod

Pawel Jakub Dawidek pjd at FreeBSD.org
Sun Aug 18 11:25:43 UTC 2013


Author: pjd
Date: Sun Aug 18 11:25:42 2013
New Revision: 254486
URL: http://svnweb.freebsd.org/changeset/base/254486

Log:
  Cast argument of is*() ctype functions to unsigned char.
  
  Without the cast there is ambiguity between 0xFF and -1 (EOF).
  
  Suggested by:	jilles
  Submitted by:	Mariusz Zaborski <oshogbo at FreeBSD.org>
  Sponsored by:	Google Summer of Code 2013

Modified:
  head/usr.sbin/rwhod/rwhod.c

Modified: head/usr.sbin/rwhod/rwhod.c
==============================================================================
--- head/usr.sbin/rwhod/rwhod.c	Sun Aug 18 10:44:37 2013	(r254485)
+++ head/usr.sbin/rwhod/rwhod.c	Sun Aug 18 11:25:42 2013	(r254486)
@@ -337,8 +337,11 @@ verify(char *name, int maxlen)
 
 	size = 0;
 	while (*name != '\0' && size < maxlen - 1) {
-		if (!isascii(*name) || !(isalnum(*name) || ispunct(*name)))
+		if (!isascii((unsigned char)*name) ||
+		    !(isalnum((unsigned char)*name) ||
+		    ispunct((unsigned char)*name))) {
 			return (0);
+		}
 		name++;
 		size++;
 	}


More information about the svn-src-head mailing list