summaryrefslogtreecommitdiff
path: root/libelf/libelf_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/libelf_open.c')
-rw-r--r--libelf/libelf_open.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libelf/libelf_open.c b/libelf/libelf_open.c
index 6d93c73a0312..7ec33952dfe1 100644
--- a/libelf/libelf_open.c
+++ b/libelf/libelf_open.c
@@ -39,7 +39,7 @@
#include <sys/mman.h>
#endif
-ELFTC_VCSID("$Id: libelf_open.c 2932 2013-03-30 01:26:04Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_open.c 3007 2014-03-22 08:10:14Z jkoshy $");
#define _LIBELF_INITSIZE (64*1024)
@@ -73,11 +73,11 @@ _libelf_read_special_file(int fd, size_t *fsz)
}
do {
- readsz = bufsz - datasz;
+ assert(bufsz - datasz > 0);
t = buf + datasz;
- if ((readsz = read(fd, t, readsz)) <= 0)
+ if ((readsz = read(fd, t, bufsz - datasz)) <= 0)
break;
- datasz += readsz;
+ datasz += (size_t) readsz;
} while (datasz < bufsz);
} while (readsz > 0);