From d031c05caf661a1ebfff8050ee47a06da6e262d3 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Sun, 22 Mar 2015 01:54:22 +0000 Subject: [PATCH] inet_pton 1:2:3:4:5:6:7:: regression --- src/regression/inet_pton-empty-last-field.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/regression/inet_pton-empty-last-field.c diff --git a/src/regression/inet_pton-empty-last-field.c b/src/regression/inet_pton-empty-last-field.c new file mode 100644 index 0000000..eef44dc --- /dev/null +++ b/src/regression/inet_pton-empty-last-field.c @@ -0,0 +1,16 @@ +// '0' last field in an ipv6 address cannot be abbreviated to :: +#include +#include +#include "test.h" + +int main(void) +{ + unsigned char buf[16]; + char addr[] = "1:2:3:4:5:6:7::"; + + if (inet_pton(AF_INET6, addr, buf)) { + t_error("inet_pton(%s) returned %x:%x:%x:%x:%x:%x:%x:%x, wanted a failure\n", + addr, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); + } + return t_status; +} -- 2.20.1