From e06e586c2f3b8d707fe016b3a038e1148080fa0a Mon Sep 17 00:00:00 2001 From: pfg Date: Tue, 14 Mar 2017 02:13:59 +0000 Subject: [PATCH] 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 --- usr.bin/localedef/ctype.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/localedef/ctype.c b/usr.bin/localedef/ctype.c index 0e238d79080..165ee9b806e 100644 --- a/usr.bin/localedef/ctype.c +++ b/usr.bin/localedef/ctype.c @@ -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++; -- 2.45.0