From ac9ddca792302dbb38e41cc94eaccd9637fdadfd Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 14 Mar 2014 23:08:49 +0000 Subject: [PATCH] [net] fix an exception in DownloadFile() * As per the MSDN, HttpOpenRequest's 6th parameter should be a NULL terminated list --- src/net.c | 3 ++- src/rufus.rc | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/net.c b/src/net.c index 69c736f8..5d3fdfc8 100644 --- a/src/net.c +++ b/src/net.c @@ -246,6 +246,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog) DWORD dwFlags, dwSize, dwDownloaded, dwTotalSize, dwStatus; FILE* fd = NULL; LONG progress_style; + const char* accept_types[] = {"*/*\0", NULL}; unsigned char buf[DOWNLOAD_BUFFER_SIZE]; char agent[64], hostname[64], urlpath[128]; HINTERNET hSession = NULL, hConnection = NULL, hRequest = NULL; @@ -304,7 +305,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog) goto out; } - hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, (const char**)"*/*\0", + hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types, INTERNET_FLAG_HYPERLINK|INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP|INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|INTERNET_FLAG_NO_COOKIES| INTERNET_FLAG_NO_UI|INTERNET_FLAG_NO_CACHE_WRITE, (DWORD_PTR)NULL); if (hRequest == NULL) { diff --git a/src/rufus.rc b/src/rufus.rc index 8d65003f..8578e8b0 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 1.4.6.435" +CAPTION "Rufus 1.4.6.436" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -165,7 +165,7 @@ END RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Rufus 1.4.6.435" +CAPTION "Rufus 1.4.6.436" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -427,8 +427,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,6,435 - PRODUCTVERSION 1,4,6,435 + FILEVERSION 1,4,6,436 + PRODUCTVERSION 1,4,6,436 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -445,13 +445,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.4.6.435" + VALUE "FileVersion", "1.4.6.436" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.4.6.435" + VALUE "ProductVersion", "1.4.6.436" END END BLOCK "VarFileInfo"