$NetBSD$
fix CVE-2010-0624

--- lib/rtapelib.c.orig	2010-03-23 16:14:45.037892500 -0500
+++ lib/rtapelib.c	2010-03-23 16:16:25.765812000 -0500
@@ -573,6 +573,9 @@
       || (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);
