dn_expand regression test
authorSzabolcs Nagy <nsz@port70.net>
Wed, 13 Aug 2014 07:35:38 +0000 (09:35 +0200)
committerSzabolcs Nagy <nsz@port70.net>
Wed, 13 Aug 2014 07:35:38 +0000 (09:35 +0200)
src/regression/dn_expand-empty.c [new file with mode: 0644]

diff --git a/src/regression/dn_expand-empty.c b/src/regression/dn_expand-empty.c
new file mode 100644 (file)
index 0000000..62c52e3
--- /dev/null
@@ -0,0 +1,16 @@
+// dn_expand should accept empty name (single \0)
+#include <resolv.h>
+#include "test.h"
+
+int main(void)
+{
+       unsigned char packet[] = "";
+       char name[] = "x";
+       int r;
+       r = dn_expand(packet, packet+1, packet, name, 1);
+       if (r!=1)
+               t_error("__dn_expand(\"\") returned %d, wanted 1\n", r);
+       if (*name)
+               t_error("__dn_expand(\"\") failed: got \"%s\" wanted \"\"\n", name);
+       return t_status;
+}