diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-08-08 17:27:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-08 17:27:50 -0400 |
commit | cdbd54972bb96fa8288301a528b02254fd0b4261 (patch) | |
tree | 5cc3438eff8ab78c89cd380fbc19a3df5df12bfe | |
parent | a2909aa35faf941a30b1496e74c278accc3fb15b (diff) | |
download | rneovim-cdbd54972bb96fa8288301a528b02254fd0b4261.tar.gz rneovim-cdbd54972bb96fa8288301a528b02254fd0b4261.tar.bz2 rneovim-cdbd54972bb96fa8288301a528b02254fd0b4261.zip |
option: pvs/v557 (#14740)
Replace STRCAT with STRLCAT() to always NUL-terminate "errbuf" array.
-rw-r--r-- | src/nvim/option.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index a4b33118cf..c3f9909b9d 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1408,22 +1408,19 @@ int do_set( *errbuf = NUL; i = getdigits_int(&arg, true, 0); if (i & 1) { - STRCAT(errbuf, "b,"); + STRLCAT(errbuf, "b,", sizeof(errbuf)); } if (i & 2) { - STRCAT(errbuf, "s,"); + STRLCAT(errbuf, "s,", sizeof(errbuf)); } if (i & 4) { - STRCAT(errbuf, "h,l,"); + STRLCAT(errbuf, "h,l,", sizeof(errbuf)); } if (i & 8) { - STRCAT(errbuf, "<,>,"); + STRLCAT(errbuf, "<,>,", sizeof(errbuf)); } if (i & 16) { - STRCAT(errbuf, "[,],"); - } - if (*errbuf != NUL) { // remove trailing , - errbuf[STRLEN(errbuf) - 1] = NUL; + STRLCAT(errbuf, "[,],", sizeof(errbuf)); } save_arg = arg; arg = errbuf; |