summaryrefslogtreecommitdiffstats
path: root/lib/libstdthreads
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-02-26 09:42:03 +0000
committerkib <kib@FreeBSD.org>2015-02-26 09:42:03 +0000
commit568d7afbb3a2c5c6316a1011486e10c712ec4532 (patch)
treee226b8324bb300f2e2a0555773bb1053648e18a9 /lib/libstdthreads
parent2bf4f586fae278b68297b1e05dfbaa2df947f1c3 (diff)
downloadFreeBSD-src-568d7afbb3a2c5c6316a1011486e10c712ec4532.zip
FreeBSD-src-568d7afbb3a2c5c6316a1011486e10c712ec4532.tar.gz
Check that the pointer to the thread return value is not NULL before
dereferencing. NULL is allowed by C11 and must be handled. Reported and tested by: Vineela <vineela_17@yahoo.com> PR: 198038 Sponsored by: The FreeBSD Foundation MFC after: 1 week
Diffstat (limited to 'lib/libstdthreads')
-rw-r--r--lib/libstdthreads/thrd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libstdthreads/thrd.c b/lib/libstdthreads/thrd.c
index f0ce55a..b0e36ef 100644
--- a/lib/libstdthreads/thrd.c
+++ b/lib/libstdthreads/thrd.c
@@ -108,7 +108,8 @@ thrd_join(thrd_t thr, int *res)
if (pthread_join(thr, &value_ptr) != 0)
return (thrd_error);
- *res = (intptr_t)value_ptr;
+ if (res != NULL)
+ *res = (intptr_t)value_ptr;
return (thrd_success);
}
OpenPOWER on IntegriCloud