pthread : Add null check at pthread_getstacksize
authorjunmin kim <junmindd.kim@samsung.com>
Tue, 23 May 2017 04:15:52 +0000 (21:15 -0700)
committerjunmin kim <junmindd.kim@samsung.com>
Tue, 23 May 2017 07:53:26 +0000 (00:53 -0700)
Without this condition, null dereference assert will occur

lib/libc/pthread/pthread_attrgetstacksize.c

index 605a45e..415ef01 100644 (file)
@@ -106,7 +106,7 @@ int pthread_attr_getstacksize(FAR const pthread_attr_t *attr, FAR long *stacksiz
 
        sdbg("attr=0x%p stacksize=0x%p\n", attr, stacksize);
 
-       if (!stacksize) {
+       if (!attr || !stacksize) {
                ret = EINVAL;
        } else {
                *stacksize = attr->stacksize;