Author: pfg
Date: Tue Mar 14 02:13:59 2017
New Revision: 315224
URL: https://svnweb.freebsd.org/changeset/base/315224

Log:
  MFC r314974, r315006:
  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

Modified:
  stable/11/usr.bin/localedef/ctype.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/localedef/ctype.c
==============================================================================
--- stable/11/usr.bin/localedef/ctype.c Tue Mar 14 02:10:37 2017        
(r315223)
+++ stable/11/usr.bin/localedef/ctype.c Tue Mar 14 02:13:59 2017        
(r315224)
@@ -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,12 +379,12 @@ 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))
                        conflict++;
-               if ((ctn->ctype & _ISCNTRL) & _ISPRINT)
+               if ((ctn->ctype & _ISCNTRL) && (ctn->ctype & _ISPRINT))
                        conflict++;
                if ((wc == ' ') && (ctn->ctype & (_ISPUNCT|_ISGRAPH)))
                        conflict++;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to