From d3be9f37969c2cda2acb138af717c3e490b4a548 Mon Sep 17 00:00:00 2001 From: Simen Endsjø Date: Sun, 2 Mar 2014 19:37:37 +0100 Subject: Assert that vim_strsize and vim_strnsize gets a non-null parameter. --- src/charset.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/charset.c b/src/charset.c index ad84f09874..3f609801a2 100644 --- a/src/charset.c +++ b/src/charset.c @@ -600,6 +600,8 @@ int ptr2cells(char_u *p) /* * Return the number of character cells string "s" will take on the screen, * counting TABs as two characters: "^I". + * + * 's' must be non-null. */ int vim_strsize(char_u *s) { @@ -609,9 +611,12 @@ int vim_strsize(char_u *s) /* * Return the number of character cells string "s[len]" will take on the * screen, counting TABs as two characters: "^I". + * + * 's' must be non-null. */ int vim_strnsize(char_u *s, int len) { + assert(s); int size = 0; while (*s != NUL && --len >= 0) { -- cgit