From b8579c04da0db3abdbbc7c297c5d23d977dce5df Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 19 Feb 2020 12:41:13 +0000 Subject: [PATCH] [misc] add arbitrary buffer allocation to GetResource() * If duplicate is TRUE and len is non-zero, then a buffer of len size, padded with zeroes, is allocated for the resource. --- src/dos.c | 3 ++- src/rufus.c | 1 + src/rufus.rc | 10 +++++----- src/stdfn.c | 20 ++++++++++++++++---- src/stdlg.c | 2 +- src/syslinux.c | 3 ++- 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/dos.c b/src/dos.c index c5566c13..91119cd6 100644 --- a/src/dos.c +++ b/src/dos.c @@ -2,7 +2,7 @@ * Rufus: The Reliable USB Formatting Utility * DOS boot file extraction, from the FAT12 floppy image in diskcopy.dll * (MS WinME DOS) or from the embedded FreeDOS resource files - * Copyright © 2011-2017 Pete Batard + * Copyright © 2011-2020 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -317,6 +317,7 @@ static BOOL ExtractMSDOS(const char* path) goto out; } + DiskImageSize = 0; DiskImage = (BYTE*)GetResource(hDLL, MAKEINTRESOURCEA(1), "BINFILE", "disk image", &DiskImageSize, TRUE); if (DiskImage == NULL) goto out; diff --git a/src/rufus.c b/src/rufus.c index 2e5b7de8..b20aaf4c 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -1633,6 +1633,7 @@ static void InitDialog(HWND hDlg) uprintf(APPLICATION_NAME " " APPLICATION_ARCH " v%d.%d.%d%s%s", rufus_version[0], rufus_version[1], rufus_version[2], IsAlphaOrBeta(), (ini_file != NULL)?"(Portable)":""); for (i=0; i