Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 2015 09:00:27 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r279631 - stable/10/lib/libstdthreads
Message-ID:  <201503050900.t2590R8p024625@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Mar  5 09:00:27 2015
New Revision: 279631
URL: https://svnweb.freebsd.org/changeset/base/279631

Log:
  MFC r279318:
  Check that the pointer to the thread return value is not NULL before
  dereferencing. NULL is allowed by C11 and must be handled.

Modified:
  stable/10/lib/libstdthreads/thrd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libstdthreads/thrd.c
==============================================================================
--- stable/10/lib/libstdthreads/thrd.c	Thu Mar  5 08:53:10 2015	(r279630)
+++ stable/10/lib/libstdthreads/thrd.c	Thu Mar  5 09:00:27 2015	(r279631)
@@ -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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503050900.t2590R8p024625>