Index: cpio-2.9/lib/rtapelib.c
===================================================================
--- cpio-2.9.orig/lib/rtapelib.c
+++ cpio-2.9/lib/rtapelib.c
@@ -573,6 +573,9 @@ rmt_read__ (int handle, char *buffer, si
       || (status = get_status (handle)) == SAFE_READ_ERROR)
     return SAFE_READ_ERROR;
 
+  if (status > length)
+    return SAFE_READ_ERROR;
+
   for (counter = 0; counter < status; counter += rlen, buffer += rlen)
     {
       rlen = safe_read (READ_SIDE (handle), buffer, status - counter);
