mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 01:02:09 +00:00
coverity/71530: Prefer STRLCPY to STRCPY in option.c
Addresses Coverity CID 71530 Prefer sizeof(NameBuff) Add braces for Travis lint Break long line Properly align parameters in multi-line function call
This commit is contained in:
@@ -5947,13 +5947,17 @@ option_value2string (
|
|||||||
if (opp->flags & P_NUM) {
|
if (opp->flags & P_NUM) {
|
||||||
long wc = 0;
|
long wc = 0;
|
||||||
|
|
||||||
if (wc_use_keyname(varp, &wc))
|
if (wc_use_keyname(varp, &wc)) {
|
||||||
STRCPY(NameBuff, get_special_key_name((int)wc, 0));
|
STRLCPY(NameBuff, get_special_key_name((int)wc, 0), sizeof(NameBuff));
|
||||||
else if (wc != 0)
|
} else if (wc != 0) {
|
||||||
STRCPY(NameBuff, transchar((int)wc));
|
STRLCPY(NameBuff, transchar((int)wc), sizeof(NameBuff));
|
||||||
else
|
} else {
|
||||||
sprintf((char *)NameBuff, "%" PRId64, (int64_t)*(long *)varp);
|
snprintf((char *)NameBuff,
|
||||||
} else { /* P_STRING */
|
sizeof(NameBuff),
|
||||||
|
"%" PRId64,
|
||||||
|
(int64_t)*(long *)varp);
|
||||||
|
}
|
||||||
|
} else { // P_STRING
|
||||||
varp = *(char_u **)(varp);
|
varp = *(char_u **)(varp);
|
||||||
if (varp == NULL) /* just in case */
|
if (varp == NULL) /* just in case */
|
||||||
NameBuff[0] = NUL;
|
NameBuff[0] = NUL;
|
||||||
|
Reference in New Issue
Block a user