]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] scan-build: Use of zero allocated in switch_xml_str2utf8()
authorAndrey Volk <andywolk@gmail.com>
Thu, 22 Apr 2021 22:40:33 +0000 (01:40 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 19 Oct 2021 17:30:18 +0000 (20:30 +0300)
src/switch_xml.c

index a48f9ab96d8d936beefff8919e288c1947120c20..cee1a4b833458f10b800547469fca01cde16dc8e 100644 (file)
@@ -968,6 +968,9 @@ static char *switch_xml_str2utf8(char **s, switch_size_t *len)
        if (be == -1)
                return NULL;                    /* not UTF-16 */
 
+       if (*len <= 3)
+               return NULL;
+
        u = (char *) switch_must_malloc(max);
        for (sl = 2; sl < *len - 1; sl += 2) {
                c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)     /* UTF-16BE */