Author: kib
Date: Thu Feb 26 09:42:03 2015
New Revision: 279318
URL: https://svnweb.freebsd.org/changeset/base/279318

Log:
  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...@yahoo.com>
  PR:   198038
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/lib/libstdthreads/thrd.c

Modified: head/lib/libstdthreads/thrd.c
==============================================================================
--- head/lib/libstdthreads/thrd.c       Thu Feb 26 09:31:25 2015        
(r279317)
+++ head/lib/libstdthreads/thrd.c       Thu Feb 26 09:42:03 2015        
(r279318)
@@ -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);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to