fix(fileio): copy to correct buffer position when reading

fixes #29186 (likely)

fixup for #29093 064483a2b
This commit is contained in:
bfredl
2024-06-06 13:48:05 +02:00
parent 78d3f47428
commit 84ad95fdc9

View File

@ -300,7 +300,7 @@ ptrdiff_t file_read(FileDescriptor *const fp, char *const ret_buf, const size_t
} else {
fp->write_pos += r_ret;
size_t to_copy = MIN((size_t)r_ret, read_remaining);
memcpy(ret_buf, fp->read_pos, to_copy);
memcpy(buf, fp->read_pos, to_copy);
fp->read_pos += to_copy;
read_remaining -= to_copy;
}