summaryrefslogtreecommitdiffstats
path: root/src/basic
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-04-03 17:00:55 +0200
committerMike Yuan <me@yhndnzj.com>2024-04-03 17:51:11 +0200
commit596c9e671aa727ed5c8d9f73628ae3c91d2a7e2e (patch)
tree3861e4e5713ee31d977c457a04588eaedfeda849 /src/basic
parentMerge pull request #32065 from bluca/dlopen_debug (diff)
downloadsystemd-596c9e671aa727ed5c8d9f73628ae3c91d2a7e2e.tar.xz
systemd-596c9e671aa727ed5c8d9f73628ae3c91d2a7e2e.zip
string-util: add missing assertion in cellescape
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/string-util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index b50f45f7f4..f3ab2dc222 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;
}