summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Dudani <adudani@quicinc.com>2009-10-12 00:53:07 -0700
committerAjay Dudani <adudani@quicinc.com>2009-10-12 10:12:00 -0700
commit0e94a29e3cde77f0bb63f3670a81d80c484a5a51 (patch)
tree65fe2f95847cc1ea3b53a430200966fb997e1ff5
parent5cef9a85b8763e1ea00ae65256e20d1377d5d27f (diff)
downloadbionic-0e94a29e3cde77f0bb63f3670a81d80c484a5a51.zip
bionic-0e94a29e3cde77f0bb63f3670a81d80c484a5a51.tar.gz
bionic-0e94a29e3cde77f0bb63f3670a81d80c484a5a51.tar.bz2
bionic: Add null check before dereferencing thread data structure
While this is not a fix for the CR, this may prevent native crash as seen in CR 212158
-rw-r--r--libc/bionic/pthread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index ec3c459..f2d9cb3 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -1538,7 +1538,11 @@ int pthread_kill(pthread_t tid, int sig)
int old_errno = errno;
pthread_internal_t * thread = (pthread_internal_t *)tid;
+ if (!thread)
+ return ESRCH;
+
ret = tkill(thread->kernel_id, sig);
+
if (ret < 0) {
ret = errno;
errno = old_errno;