diff options
-rw-r--r-- | isomd5sum/libcheckisomd5.c | 5 | ||||
-rw-r--r-- | loader2/mediacheck.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/isomd5sum/libcheckisomd5.c b/isomd5sum/libcheckisomd5.c index fc952bcaf..552055634 100644 --- a/isomd5sum/libcheckisomd5.c +++ b/isomd5sum/libcheckisomd5.c @@ -206,6 +206,11 @@ static int checkmd5sum(int isofd, char *mediasum, char *computedsum, int quiet) if (nread <= 0) break; + if (nread > nattempt) { + fprintf(stderr, "Warning: read got more data than requested\n"); + nread = nattempt; + lseek(isofd, offset+nread, SEEK_SET); + } /* overwrite md5sum we implanted with original data */ if (offset < apoff && offset+nread >= apoff) { appdata_start_offset = apoff - offset; diff --git a/loader2/mediacheck.c b/loader2/mediacheck.c index ead02a706..256f1c3ac 100644 --- a/loader2/mediacheck.c +++ b/loader2/mediacheck.c @@ -223,6 +223,11 @@ static int checkmd5sum(int isofd, char *mediasum, char *computedsum, if (nread <= 0) break; + if (nread > nattempt) { + fprintf(stderr, "Warning: read got more data than requested\n"); + nread = nattempt; + lseek(isofd, offset+nread, SEEK_SET); + } /* overwrite md5sum we implanted with original data */ if (offset < apoff && offset+nread >= apoff) { appdata_start_offset = apoff - offset; |