From 8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 19 Mar 2005 21:04:10 +0000 Subject: Updated to fedora-glibc-20050319T1907 --- debug/pread64_chk.c | 2 +- debug/pread_chk.c | 2 +- debug/recv_chk.c | 9 +++------ debug/recvfrom_chk.c | 10 +++------- debug/tst-chk1.c | 2 +- 5 files changed, 9 insertions(+), 16 deletions(-) (limited to 'debug') diff --git a/debug/pread64_chk.c b/debug/pread64_chk.c index d281ad54af..c0e0efdf85 100644 --- a/debug/pread64_chk.c +++ b/debug/pread64_chk.c @@ -26,6 +26,6 @@ __pread64_chk (int fd, void *buf, size_t nbytes, off64_t offset, size_t buflen) if (nbytes > buflen) __chk_fail (); - return __pread64 (fd, buf, offset, nbytes); + return __pread64 (fd, buf, nbytes, offset); } #endif diff --git a/debug/pread_chk.c b/debug/pread_chk.c index cf4f9f203c..702fddaaa3 100644 --- a/debug/pread_chk.c +++ b/debug/pread_chk.c @@ -26,6 +26,6 @@ __pread_chk (int fd, void *buf, size_t nbytes, off_t offset, size_t buflen) if (nbytes > buflen) __chk_fail (); - return __pread (fd, buf, offset, nbytes); + return __pread (fd, buf, nbytes, offset); } #endif 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 diff --git a/debug/recvfrom_chk.c b/debug/recvfrom_chk.c index 9403479c00..6fefcbd767 100644 --- a/debug/recvfrom_chk.c +++ b/debug/recvfrom_chk.c @@ -24,13 +24,9 @@ ssize_t __recvfrom_chk (int fd, void *buf, size_t n, size_t buflen, int flags, __SOCKADDR_ARG addr, socklen_t *addr_len) { - /* 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 = __recvfrom (fd, buf, MIN (n, buflen + 1), flags, - addr, addr_len); - if (nrecv > 0 && (size_t) nrecv > buflen) + if (n > buflen) __chk_fail (); - return nrecv; + + return __recvfrom (fd, buf, n, flags, addr, addr_len); } #endif diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c index dca41ab6dc..a9a7761f9e 100644 --- a/debug/tst-chk1.c +++ b/debug/tst-chk1.c @@ -771,7 +771,7 @@ do_test (void) || strcmp (getcwdbuf + 1, fname) != 0) FAIL (); -#if __USE_FORTIFY_LEVEL >= 1 +#if 0 && __USE_FORTIFY_LEVEL >= 1 CHK_FAIL_START if (getwd (getcwdbuf + 2) != getcwdbuf + 2) FAIL (); -- cgit v1.2.3-70-g09d2