svn commit: r314974 - head/usr.bin/localedef

Pedro F. Giffuni pfg at FreeBSD.org
Thu Mar 9 21:49:12 UTC 2017


Author: pfg
Date: Thu Mar  9 21:49:11 2017
New Revision: 314974
URL: https://svnweb.freebsd.org/changeset/base/314974

Log:
  localedef(1): Fix small coverity issues.
  
  - Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
  - Buffer not null terminated (BUFFER_SIZE_WARNING)
  
  CID:	1338557, 1338565
  
  Obtained from:	illumos
  MFC after:	5 days

Modified:
  head/usr.bin/localedef/ctype.c

Modified: head/usr.bin/localedef/ctype.c
==============================================================================
--- head/usr.bin/localedef/ctype.c	Thu Mar  9 21:05:47 2017	(r314973)
+++ head/usr.bin/localedef/ctype.c	Thu Mar  9 21:49:11 2017	(r314974)
@@ -306,7 +306,7 @@ dump_ctype(void)
 		return;
 
 	(void) memcpy(rl.magic, _FILE_RUNE_MAGIC_1, 8);
-	(void) strncpy(rl.encoding, get_wide_encoding(), sizeof (rl.encoding));
+	(void) strlcpy(rl.encoding, get_wide_encoding(), sizeof (rl.encoding));
 
 	/*
 	 * Initialize the identity map.
@@ -379,7 +379,7 @@ dump_ctype(void)
 		if ((ctn->ctype & _ISALPHA) &&
 		    (ctn->ctype & (_ISPUNCT|_ISDIGIT)))
 			conflict++;
-		if ((ctn->ctype & _ISPUNCT) &
+		if ((ctn->ctype & _ISPUNCT) &&
 		    (ctn->ctype & (_ISDIGIT|_ISALPHA|_ISXDIGIT)))
 			conflict++;
 		if ((ctn->ctype & _ISSPACE) && (ctn->ctype & _ISGRAPH))


More information about the svn-src-all mailing list