Files
valgrind/memcheck/tests/null_socket.c
Nicholas Nethercote 2566d12bc0 Added regression tests for recent bug fix involving accept(), recvfrom() and
getsockopt() being allowed to received a NULL buffer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1581
2003-05-02 16:19:10 +00:00

22 lines
495 B
C

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
// It's legit to have NULL buffers; before the bug was fixed Valgrind
// reported spurious errors for the buffers.
int main(void)
{
if (-1 != accept(99, NULL, 0))
printf("accept succeeded?\n");
if (-1 != recvfrom(0, NULL, 0, 0, NULL, 0))
printf("recvfrom succeeded?\n");
if (-1 != getsockopt(0, 0, 0, NULL, 0))
printf("getsockopt succeeded?\n");
return 0;
}