Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Mar 2017 21:49:11 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314974 - head/usr.bin/localedef
Message-ID:  <201703092149.v29LnB7d072161@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703092149.v29LnB7d072161>