From b4547d9244cb9221bcaaa8f583c566bab5638784 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 23 Aug 2009 19:47:05 +0200 Subject: Fix pthread_setcancelstate/type crash * pthread/pt-setcancelstate.c (pthread_setcancelstate): Check whether OLDSTATE is NULL before filling it. * pthread/pt-setcanceltype.c (pthread_setcanceltype): Likewise. --- pthread/pt-setcancelstate.c | 3 ++- pthread/pt-setcanceltype.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'pthread') diff --git a/pthread/pt-setcancelstate.c b/pthread/pt-setcancelstate.c index ded5892..e2d8183 100644 --- a/pthread/pt-setcancelstate.c +++ b/pthread/pt-setcancelstate.c @@ -35,7 +35,8 @@ pthread_setcancelstate (int state, int *oldstate) break; } - *oldstate = p->cancel_state; + if (oldstate) + *oldstate = p->cancel_state; p->cancel_state = state; return 0; diff --git a/pthread/pt-setcanceltype.c b/pthread/pt-setcanceltype.c index 9511c99..3ce4259 100644 --- a/pthread/pt-setcanceltype.c +++ b/pthread/pt-setcanceltype.c @@ -35,7 +35,8 @@ pthread_setcanceltype (int type, int *oldtype) break; } - *oldtype = p->cancel_type; + if (oldtype) + *oldtype = p->cancel_type; p->cancel_type = type; return 0; -- cgit v1.2.3