xref: /aosp_15_r20/cts/hostsidetests/securitybulletin/securityPatch/CVE-2018-9466/poc-CVE-2017-9049.c (revision b7c941bb3fa97aba169d73cee0bed2de8ac964bf)
1 /**
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include <libxml/parser.h>
17 #include <libxml/relaxng.h>
18 #include <libxml/valid.h>
19 #include <libxml/xmlerror.h>
20 #include <libxml/xmlschemas.h>
21 #include <libxml/xmlschemastypes.h>
22 #include <stdlib.h>
23 #include <string.h>
24 
25 #include "libxml.h"
26 
xmlPosixStrdup(const char * cur)27 static char *xmlPosixStrdup(const char *cur) {
28   return ((char *)xmlCharStrdup(cur));
29 }
30 
main(int argc,char ** argv)31 int main(int argc, char **argv) {
32   if (argc != 2) {
33     return EXIT_FAILURE;
34   }
35   xmlGetWarningsDefaultValue = 0;
36   xmlPedanticParserDefault(0);
37   xmlGcMemSetup(free, malloc, malloc, realloc, xmlPosixStrdup);
38   xmlInitParser();
39   xmlSchemaInitTypes();
40   xmlRelaxNGInitTypes();
41   xmlReadFile(argv[1], NULL, XML_PARSE_OLD10);
42   return EXIT_SUCCESS;
43 }
44