aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2021-01-20 22:17:01 -0800
committerGarrett D'Amore <garrett@damore.org>2021-01-24 17:59:37 -0800
commite4152a37c6e288382c64942edc2edda410681c9b (patch)
tree6f8581654b1feb06c92399dc7f207745808c698c /src
parent1731cf6e49e5a8dabc532fa2ef2894c95212911e (diff)
downloadnng-e4152a37c6e288382c64942edc2edda410681c9b.tar.gz
nng-e4152a37c6e288382c64942edc2edda410681c9b.tar.bz2
nng-e4152a37c6e288382c64942edc2edda410681c9b.zip
fixes #1413 nni_thr_setname NULL pointer dereference
Diffstat (limited to 'src')
-rw-r--r--src/core/thread.c4
-rw-r--r--src/sp/transport/ws/ws_test.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/core/thread.c b/src/core/thread.c
index f686612b..6f50476a 100644
--- a/src/core/thread.c
+++ b/src/core/thread.c
@@ -1,5 +1,5 @@
//
-// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
@@ -171,5 +171,5 @@ nni_thr_is_self(nni_thr *thr)
void
nni_thr_set_name(nni_thr *thr, const char *name)
{
- nni_plat_thr_set_name(&thr->thr, name);
+ nni_plat_thr_set_name(thr != NULL ? &thr->thr : NULL, name);
} \ No newline at end of file
diff --git a/src/sp/transport/ws/ws_test.c b/src/sp/transport/ws/ws_test.c
index 4a2b58c2..b5e72b79 100644
--- a/src/sp/transport/ws/ws_test.c
+++ b/src/sp/transport/ws/ws_test.c
@@ -106,8 +106,8 @@ test_wild_card_host(void)
snprintf(addr, sizeof(addr), "ws://127.0.0.1:%u/test", port);
NUTS_PASS(nng_dial(s2, addr, NULL, 0));
- NUTS_CLOSE(s1);
NUTS_CLOSE(s2);
+ NUTS_CLOSE(s1);
}
static void
@@ -131,8 +131,8 @@ test_empty_host(void)
snprintf(addr, sizeof(addr), "ws://127.0.0.1:%u/test", port);
NUTS_PASS(nng_dial(s2, addr, NULL, 0));
- NUTS_CLOSE(s1);
NUTS_CLOSE(s2);
+ NUTS_CLOSE(s1);
}
void