From 0fbd1ea230118742a1718c841a9aa6d2e2837cdd Mon Sep 17 00:00:00 2001 From: Flan's server Date: Thu, 3 Jun 2021 18:22:15 +0000 Subject: [PATCH] fixed inaccurate buffer read --- src/bits.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bits.c b/src/bits.c index e733961..d860461 100644 --- a/src/bits.c +++ b/src/bits.c @@ -25,7 +25,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; }