[PATCH] fixed #2175
authorjeanlf <jeanlf@gpac.io>
Tue, 19 Apr 2022 07:15:58 +0000 (09:15 +0200)
committerMoritz Mühlenhoff <jmm@debian.org>
Mon, 19 Jun 2023 21:46:06 +0000 (22:46 +0100)
Gbp-Pq: Name CVE-2022-1441.patch

src/isomedia/box_code_3gpp.c

index 0e8681c4d490092c9368be8fc03d8da3a374a53a..f48c77759f5244988b687dce76338070b420ae4c 100644 (file)
@@ -1121,20 +1121,12 @@ void diST_box_del(GF_Box *s)
 
 GF_Err diST_box_read(GF_Box *s, GF_BitStream *bs)
 {
-       u32 i;
-       char str[1024];
        GF_DIMSScriptTypesBox *p = (GF_DIMSScriptTypesBox *)s;
 
-       i=0;
-       str[0]=0;
-       while (1) {
-               str[i] = gf_bs_read_u8(bs);
-               if (!str[i]) break;
-               i++;
-       }
-       ISOM_DECREASE_SIZE(p, i);
-
-       p->content_script_types = gf_strdup(str);
+       p->content_script_types = gf_malloc(sizeof(char) * (s->size+1));
+       if (!p->content_script_types) return GF_OUT_OF_MEM;
+       gf_bs_read_data(bs, p->content_script_types, s->size);
+       p->content_script_types[s->size] = 0;
        return GF_OK;
 }