CVE-2015-5330: Fix handling of unicode near string endings
[samba.git] / lib / util / charset / util_str.c
index d2e6cbbc620e09102e203b293f538a1e3b8bf474..2653bfc2d819585ad0b9acb65dc340ae402d46d1 100644 (file)
@@ -210,7 +210,8 @@ _PUBLIC_ size_t strlen_m_ext_handle(struct smb_iconv_handle *ic,
 
        while (*s) {
                size_t c_size;
-               codepoint_t c = next_codepoint_handle_ext(ic, s, src_charset, &c_size);
+               codepoint_t c = next_codepoint_handle_ext(ic, s, strnlen(s, 5),
+                                                         src_charset, &c_size);
                s += c_size;
 
                switch (dst_charset) {