From: Mike Yuan Date: Wed, 3 Apr 2024 15:00:55 +0000 (+0800) Subject: string-util: add missing assertion in cellescape X-Git-Tag: v256-rc1~322^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=596c9e671aa727ed5c8d9f73628ae3c91d2a7e2e;p=thirdparty%2Fsystemd.git string-util: add missing assertion in cellescape --- diff --git a/src/basic/string-util.c b/src/basic/string-util.c index b50f45f7f4a..f3ab2dc2223 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -562,7 +562,9 @@ char *cellescape(char *buf, size_t len, const char *s) { size_t i = 0, last_char_width[4] = {}, k = 0; + assert(buf); assert(len > 0); /* at least a terminating NUL */ + assert(s); for (;;) { char four[4]; @@ -612,7 +614,7 @@ char *cellescape(char *buf, size_t len, const char *s) { else assert(i + 1 <= len); - done: +done: buf[i] = '\0'; return buf; }