dvd-sector-copy.c: Limit `recovery_read' return value to length requested.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 19 Feb 2022 11:53:22 +0000 (11:53 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 19 Feb 2022 11:55:20 +0000 (11:55 +0000)
Otherwise the caller gets properly confused.

dvd-sector-copy.c

index 4d44122..86540e0 100644 (file)
@@ -663,6 +663,7 @@ static ssize_t recovery_read(struct recoverybuf *r,
 
   n = r->pos + r->end - pos;
   if (!n && want) n = -1;
+  else if (n > want) n = want;
 
 end:
 #ifdef DEBUG