1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix potential corruption when writing help file.

When the standalone version of a binary, with its help file included
as a resource, extracts that resource to write it to a disk, it could
have accidentally skipped a byte in the middle if the WriteFile call
in this loop had not managed to write the whole file in one go.

(cherry picked from commit 775d969ca8)
This commit is contained in:
Simon Tatham 2023-04-07 07:39:49 +01:00
parent a02fd09854
commit c3aba5d959

View File

@ -118,7 +118,7 @@ static bool load_chm_resource(void)
created = true;
const uint8_t *p = (const uint8_t *)chm_resource;
for (DWORD pos = 0; pos < chm_resource_size; pos++) {
for (DWORD pos = 0; pos < chm_resource_size ;) {
DWORD to_write = chm_resource_size - pos;
DWORD written = 0;