NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/46985: sem_post does not validate arguments



>Number:         46985
>Category:       lib
>Synopsis:       sem_post does not validate arguments
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 19 18:50:00 +0000 2012
>Originator:     Aran Clauson
>Release:        NetBSD 6.99.11
>Organization:
>Environment:
NetBSD sanders 6.99.11 NetBSD 6.99.11 (SANDERS) #0: Mon Sep 17 14:11:22 PDT 
2012  aran@sanders:/home/NetBSD/obj/sys/arch/amd64/compile/SANDERS amd64
>Description:
calling sem_post (NULL) crashes the program.  The documentation says that it 
should return -1 with errno=EINVAL.  The problem is that macro ERRORCHECK is 
undefined in src/lib/libpthread/sem.c.  That macro is defined in pthread_int.h 
and that head used to be included by sem.c.  However, at revision 1.22 of 
sem.c, the include was removed.
>How-To-Repeat:
compile and run

#include <semaphore.h>
int main () 
{
  sem_post (NULL);
  return 0;
}
>Fix:
inlcude pthread_int.h in sem.c



Home | Main Index | Thread Index | Old Index