diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-03-03 16:52:27 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-03-03 16:52:27 +0000 |
commit | 1f53f6f82f2165e421d94a83a731c1308097849f (patch) | |
tree | c264f23f46c0f440348f75093e59cacfc9c60dba /socket | |
parent | a3f1b27bd61b4bd1645e90953eb09ae2aa3ef9e9 (diff) | |
download | glibc-1f53f6f82f2165e421d94a83a731c1308097849f.tar.gz |
2.3.4-11
Diffstat (limited to 'socket')
-rw-r--r-- | socket/bits/socket2.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h index 0ccb24ca31..6998dca20d 100644 --- a/socket/bits/socket2.h +++ b/socket/bits/socket2.h @@ -21,18 +21,17 @@ # error "Never include <bits/socket2.h> directly; use <sys/socket.h> instead." #endif -extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen, - int __flags); +extern void __chk_fail (void) __attribute__((noreturn)); #define recv(fd, buf, n, flags) \ - (__bos0 (buf) != (size_t) -1 \ - ? __recv_chk (fd, buf, n, __bos0 (buf), flags) \ - : recv (fd, buf, n, flags)) + (__extension__ \ + ({ size_t __n_val = (__n); \ + if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __n_val) \ + __chk_fail (); \ + recv (fd, buf, __n_val, flags); })) -extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, - size_t __buflen, int __flags, - __SOCKADDR_ARG __addr, - socklen_t *__restrict __addr_len); #define recvfrom(fd, buf, n, flags, addr, addr_len) \ - (__bos0 (buf) != (size_t) -1 \ - ? __recvfrom_chk (fd, buf, n, __bos0 (buf), flags, addr, addr_len) \ - : recvfrom (fd, buf, n, flags, addr, addr_len)) + (__extension__ \ + ({ size_t __n_val = (__n); \ + if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __n_val) \ + __chk_fail (); \ + recvfrom (fd, buf, __n_val, flags, addr, addr_len); })) |