dont try to modify offset if size is 0
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 12 Mar 2010 17:20:25 +0000 (04:20 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 12 Mar 2010 17:20:25 +0000 (04:20 +1100)
it will generate a division by zero fault and crash the thread

libnfs.c

index 3f60eff5210775ca09ede0793479236ec8b03bf8..915526aa0d3790a47c7318d60fd82f2c0b620290 100644 (file)
--- a/libnfs.c
+++ b/libnfs.c
@@ -831,7 +831,7 @@ nfsstat3 nfsio_read(struct nfsio *nfsio, const char *name, char *buf, uint64_t o
                goto finished;
        }
 
-       if (offset >= size) {
+       if (offset >= size && size > 0) {
                offset = offset % size;
        }
        if (offset+len >= size) {