From: Stefan Metzmacher Date: Fri, 8 May 2026 20:33:32 +0000 (+0200) Subject: CVE-2026-4480/CVE-2026-4408: lib/util: let log_escape() make use of iscntrl() X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=88c45db50d2289afd750ca25f2acf9ed4ceb9819;p=thirdparty%2Fsamba.git CVE-2026-4480/CVE-2026-4408: lib/util: let log_escape() make use of iscntrl() using iscntrl() also handles 0x7F (DEL). BUG: https://bugzilla.samba.org/show_bug.cgi?id=16033 BUG: https://bugzilla.samba.org/show_bug.cgi?id=16034 Signed-off-by: Stefan Metzmacher Reviewed-by: Douglas Bagnall --- diff --git a/lib/util/util_str_escape.c b/lib/util/util_str_escape.c index 8f1f34912ee..c6d7a0c9e77 100644 --- a/lib/util/util_str_escape.c +++ b/lib/util/util_str_escape.c @@ -18,6 +18,7 @@ */ #include "replace.h" +#include "system/locale.h" #include "lib/util/debug.h" #include "lib/util/util_str_escape.h" @@ -28,7 +29,7 @@ */ static size_t encoded_length(unsigned char c) { - if (c != '\\' && c > 0x1F) { + if (c != '\\' && !iscntrl(c)) { return 1; } else { switch (c) { @@ -79,7 +80,7 @@ char *log_escape(TALLOC_CTX *frame, const char *in) c = in; e = encoded; while (*c) { - if (*c != '\\' && (unsigned char)(*c) > 0x1F) { + if (*c != '\\' && !iscntrl((unsigned char)(*c))) { *e++ = *c++; } else { switch (*c) {