]> sourceware.org Git - glibc.git/blobdiff - debug/pread_chk.c
.
[glibc.git] / debug / pread_chk.c
index 6dfa2ab499a429617fa52b4a58333ecc90cbbd02..de111eaf824dc2efdbd75936cedfe6a9961a4c75 100644 (file)
 ssize_t
 __pread_chk (int fd, void *buf, size_t nbytes, off_t offset, size_t buflen)
 {
 ssize_t
 __pread_chk (int fd, void *buf, size_t nbytes, off_t offset, size_t buflen)
 {
-  /* In case NBYTES 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 n = __pread (fd, buf, offset, MIN (nbytes, buflen + 1));
-  if (n > 0 && (size_t) n > buflen)
+  if (nbytes > buflen)
     __chk_fail ();
     __chk_fail ();
-  return n;
+
+  return __pread (fd, buf, nbytes, offset);
 }
 }
This page took 0.025785 seconds and 5 git commands to generate.