From 255a85d10f68a898c671f9387da61e0ba62a61c7 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 28 Dec 2019 10:55:13 -0800 Subject: fixes #986 ws_read_finish_str free invalid pointer Also, this has refactored the websocket stream test to the new acutest.h, and includes a much deeper test of fragmentation and reassembly of websocket streams. --- tests/testutil.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/testutil.c') diff --git a/tests/testutil.c b/tests/testutil.c index ef748b99..1c65c996 100644 --- a/tests/testutil.c +++ b/tests/testutil.c @@ -123,6 +123,18 @@ testutil_htons(uint16_t in) return (in); } +uint32_t +testutil_htonl(uint32_t in) +{ +#ifdef NNG_LITTLE_ENDIAN + in = ((in >> 24u) & 0xffu) | + ((in >> 8u) & 0xff00u) | + ((in << 8u) & 0xff0000u) | + ((in << 24u) & 0xff000000u); +#endif + return (in); +} + // testutil_next_port returns a "next" allocation port. // Ports are chosen by starting from a random point within a // range (normally 38000-40000, but other good places to choose -- cgit v1.2.3-70-g09d2