From fdb73b69a887d868f8e976ef8a990a5d7f6687f9 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 23 Oct 2017 08:49:58 -0700 Subject: fixes #127 Bad format TCP address causes null pointer exception I've added some tests to validate this too. --- tests/tcp6.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/tcp6.c') diff --git a/tests/tcp6.c b/tests/tcp6.c index 6f84d282..b1695c84 100644 --- a/tests/tcp6.c +++ b/tests/tcp6.c @@ -69,6 +69,16 @@ check_props_v6(nng_msg *msg, nng_listener l, nng_dialer d) So(nng_dialer_getopt(d, NNG_OPT_REMADDR, &ra, &z) != 0); }); + Convey("Malformed TCPv6 addresses do not panic", { + nng_socket s1; + + So(nng_pair_open(&s1) == 0); + Reset({ nng_close(s1); }); + So(nng_dial(s1, "tcp://::1", NULL, 0) == NNG_EADDRINVAL); + So(nng_dial(s1, "tcp://::1:5055", NULL, 0) == NNG_EADDRINVAL); + So(nng_dial(s1, "tcp://[::1]", NULL, 0) == NNG_EADDRINVAL); + }); + return (0); } -- cgit v1.2.3-70-g09d2