diff --git a/src/bits.c b/src/bits.c index 5855f5a..96c00d0 100644 --- a/src/bits.c +++ b/src/bits.c @@ -28,7 +28,7 @@ static int fwrite_all(const void* _buf, size_t sz, size_t num, FILE* out) { register size_t w, done=0; register const unsigned char* buf = _buf; - while( (w = fwrite(buf+done, sz, num-done, out)) > 0 && done < num) done+=w; + while( (w = fwrite(buf+(sz*done), sz, num-done, out)) > 0 && done < num) done+=w; if (done!=num) return 0; else return 1; }