Remove useless comparison
[pidgin-git.git] / libpurple / tests / test_xmlnode.c
blob59f8d4433870c12790ab9956ab2cccb75b56f42f
1 #include <string.h>
3 #include "tests.h"
4 #include "../xmlnode.h"
6 /*
7 * If we really wanted to test the billion laughs attack we would
8 * need to have more than just 4 ha's. But as long as this shorter
9 * document fails to parse, the longer one should also fail to parse.
11 START_TEST(test_xmlnode_billion_laughs_attack)
13 const char *malicious_xml_doc = "<!DOCTYPE root [ <!ENTITY ha \"Ha !\"><!ENTITY ha2 \"&ha; &ha;\"><!ENTITY ha3 \"&ha2; &ha2;\"> ]><root>&ha3;</root>";
15 /* Uncomment this line if you want to see the error message given by
16 the parser for the above XML document */
17 /* purple_debug_set_enabled(TRUE); */
19 fail_if(xmlnode_from_str(malicious_xml_doc, -1),
20 "xmlnode_from_str() returned an XML tree, but we didn't want it to");
22 END_TEST
24 Suite *
25 xmlnode_suite(void)
27 Suite *s = suite_create("Utility Functions");
29 TCase *tc = tcase_create("xmlnode");
30 tcase_add_test(tc, test_xmlnode_billion_laughs_attack);
31 suite_add_tcase(s, tc);
33 return s;