CPPUNIT_ASSERT(msg != NULL);
rfc1035MessageDestroy(&msg);
}
+
+void testRFC1035::testBugPacketHeadersOnly()
+{
+ /* Setup a buffer with the known-to-fail headers-only packet */
+ const char *buf = "\xab\xcd\x81\x80\x00\x01\x00\x05\x00\x04\x00\x04";
+ size_t len = 12;
+ rfc1035_message *msg = NULL;
+ int res = 0;
+ unsigned int off = 0;
+
+ /* Test the HeaderUnpack function results */
+ msg = new rfc1035_message;
+ res = rfc1035HeaderUnpack(buf, len, &off, msg);
+ CPPUNIT_ASSERT(0 == res);
+ /* cleanup */
+ delete msg;
+ msg = NULL;
+
+ /* Test the MessageUnpack function itself */
+ res = rfc1035MessageUnpack(buf, len, &msg);
+
+ CPPUNIT_ASSERT_EQUAL((const char *)"The DNS reply message is corrupt or could not be safely parsed.", rfc1035_error_message);
+ CPPUNIT_ASSERT(res < 0);
+ CPPUNIT_ASSERT(msg == NULL);
+}
CPPUNIT_TEST( testHeaderUnpack );
CPPUNIT_TEST( testParseAPacket );
+ CPPUNIT_TEST( testBugPacketHeadersOnly );
CPPUNIT_TEST( testBugPacketEndingOnCompressionPtr );
CPPUNIT_TEST_SUITE_END();
// bugs.
void testBugPacketEndingOnCompressionPtr();
+ void testBugPacketHeadersOnly();
};
#endif /* SQUID_SRC_TEST_IPADDRESS_H */