From e1c00506671062bea47166f4ee77068d8bdb8b12 Mon Sep 17 00:00:00 2001 From: John Marshall Date: Tue, 23 Jul 2013 16:16:19 +0100 Subject: [PATCH] ks_resize() canonicalises the stored string It ensures the string is NUL-terminated, especially in the case that ks_resize(&kstr,1) has been used on a newly-created kstring_t to ensure that kstr.s is not NULL. --- kstring.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kstring.h b/kstring.h index da53ba6..4c803b8 100644 --- a/kstring.h +++ b/kstring.h @@ -89,6 +89,7 @@ static inline int ks_resize(kstring_t *s, size_t size) else return -1; } + s->s[s->l] = '\0'; return 0; } -- 2.47.3