escape: teach octescape() to work with NUL terminated strings

This commit is contained in:
Lennart Poettering
2024-03-05 15:46:31 +01:00
parent 11d1c90c49
commit c6342e35b0
+6
View File
@@ -451,6 +451,12 @@ char* octescape(const char *s, size_t len) {
assert(s || len == 0);
if (len == SIZE_MAX)
len = strlen(s);
if (len > (SIZE_MAX)-1/4)
return NULL;
t = buf = new(char, len * 4 + 1);
if (!buf)
return NULL;