__recv_chk

Name

__recv_chk -- receive a message from a socket, with buffer overflow checking

Synopsis

#include <sys/socket.h>

ssize_t __recv_chk(int fd, void * buf, size_t len, size_t buflen, int flag);

Description

The interface __recv_chk() shall function in the same way as the interface recv(), except that __recv_chk() shall check for buffer overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the buffer, parameter values, and so on.

The parameter buflen specifies the size of the buffer buf. If len exceeds buflen, the function shall abort, and the program calling it shall exit.

The __recv_chk() function is not in the source standard; it is only in the binary standard.