Skip to content

Commit

Permalink
libroot: Make sure PTHREAD_STACK_MIN is in the allowed range
Browse files Browse the repository at this point in the history
  • Loading branch information
pdziepak committed Sep 16, 2013
1 parent e69b237 commit 7401809
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/system/libroot/posix/pthread/pthread_attr.c
Expand Up @@ -12,6 +12,8 @@
#include <limits.h>
#include <stdlib.h>

#include <Debug.h>

#include <thread_defs.h>


Expand Down Expand Up @@ -105,6 +107,8 @@ pthread_attr_setstacksize(pthread_attr_t *_attr, size_t stacksize)
if (_attr == NULL || (attr = *_attr) == NULL)
return B_BAD_VALUE;

STATIC_ASSERT(PTHREAD_STACK_MIN >= MIN_USER_STACK_SIZE
&& PTHREAD_STACK_MIN <= MAX_USER_STACK_SIZE);
if (stacksize < PTHREAD_STACK_MIN || stacksize > MAX_USER_STACK_SIZE)
return B_BAD_VALUE;

Expand Down

0 comments on commit 7401809

Please sign in to comment.