Commit eabfca95 authored by Petri Hintukainen's avatar Petri Hintukainen

udfread_file_read(): check for past-eof file pointer

parent 0cb2105d
...@@ -1588,6 +1588,10 @@ ssize_t udfread_file_read(UDFFILE *p, void *buf, size_t bytes) ...@@ -1588,6 +1588,10 @@ ssize_t udfread_file_read(UDFFILE *p, void *buf, size_t bytes)
return -1; return -1;
} }
if (p->pos >= udfread_file_size(p)) {
return 0;
}
/* limit range to file size */ /* limit range to file size */
if ((uint64_t)p->pos + bytes > (uint64_t)udfread_file_size(p)) { if ((uint64_t)p->pos + bytes > (uint64_t)udfread_file_size(p)) {
bytes = udfread_file_size(p) - p->pos; bytes = udfread_file_size(p) - p->pos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment