From 59fd0c4132f06a76c460f46ec93fce7b7f1d6f08 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 26 Jan 2017 14:33:03 +0100 Subject: refactor: Remove strncpy/STRNCPY. (#6008) Closes #731 References #851 Note: This does not remove some intentional legacy usages of strncpy. - memcpy isn't equivalent because it doesn't check the string length of `src`, and doesn't zero-out the remainder of `dst`. - xstrlcpy isn't equivalent because it doesn't zero-out the remainder of `dst`. Some Vim logic depends on that (e.g. ex_append which calls vim_strnsave). Helped-by: Douglas Schneider Helped-by: oni-link Helped-by: James McCoy --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index dffbbe9df9..9c041ca790 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -22314,7 +22314,7 @@ char_u *get_return_cmd(void *rettv) } STRCPY(IObuff, ":return "); - STRNCPY(IObuff + 8, s, IOSIZE - 8); + STRLCPY(IObuff + 8, s, IOSIZE - 8); if (STRLEN(s) + 8 >= IOSIZE) STRCPY(IObuff + IOSIZE - 4, "..."); xfree(tofree); -- cgit