summaryrefslogtreecommitdiff
path: root/debug/recv_chk.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/recv_chk.c')
-rw-r--r--debug/recv_chk.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/debug/recv_chk.c b/debug/recv_chk.c
index f83bd3ed2f..090e63c5b9 100644
--- a/debug/recv_chk.c
+++ b/debug/recv_chk.c
@@ -23,12 +23,9 @@
ssize_t
__recv_chk (int fd, void *buf, size_t n, size_t buflen, int flags)
{
- /* In case N is greater than BUFLEN, we read BUFLEN+1 bytes.
- This might overflow the buffer but the damage is reduced to just
- one byte. And the program will terminate right away. */
- ssize_t nrecv = __recv (fd, buf, MIN (n, buflen + 1), flags);
- if (nrecv > 0 && (size_t) nrecv > buflen)
+ if (n > buflen)
__chk_fail ();
- return nrecv;
+
+ return __recv (fd, buf, n, flags);
}
#endif