diff --git a/src/net.c b/src/net.c index 4272b668..97be44ef 100644 --- a/src/net.c +++ b/src/net.c @@ -625,17 +625,16 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) int status = 0; const char* server_url = RUFUS_URL "/"; int i, j, k, max_channel, verbose = 0, verpos[4]; - static const char* archname[] = {"win_x86", "win_x64", "win_arm", "win_arm64", "win_none"}; - static const char* channel[] = {"release", "beta", "test"}; // release channel - const char* accept_types[] = {"*/*\0", NULL}; + static const char* channel[] = { "release", "beta", "test" }; // release channel + const char* accept_types[] = { "*/*\0", NULL }; char* buf = NULL; char agent[64], hostname[64], urlpath[128], sigpath[256]; DWORD dwSize, dwDownloaded, dwTotalSize, dwStatus; BYTE *sig = NULL; - OSVERSIONINFOA os_version = {sizeof(OSVERSIONINFOA), 0, 0, 0, 0, ""}; + OSVERSIONINFOA os_version = { sizeof(OSVERSIONINFOA), 0, 0, 0, 0, "" }; HINTERNET hSession = NULL, hConnection = NULL, hRequest = NULL; - URL_COMPONENTSA UrlParts = {sizeof(URL_COMPONENTSA), NULL, 1, (INTERNET_SCHEME)0, - hostname, sizeof(hostname), 0, NULL, 1, urlpath, sizeof(urlpath), NULL, 1}; + URL_COMPONENTSA UrlParts = { sizeof(URL_COMPONENTSA), NULL, 1, (INTERNET_SCHEME)0, + hostname, sizeof(hostname), 0, NULL, 1, urlpath, sizeof(urlpath), NULL, 1 }; SYSTEMTIME ServerTime, LocalTime; FILETIME FileTime; int64_t local_time = 0, reg_time, server_time, update_interval; @@ -734,10 +733,10 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) // and then remove each of the components until we find our match. For instance, we may first // look for rufus_win_x64_6.2.ver (Win8 x64) but only get a match for rufus_win_x64_6.ver (Vista x64 or later) // This allows sunsetting OS versions (eg XP) or providing different downloads for different archs/groups. - static_sprintf(urlpath, "%s%s%s_%s_%lu.%lu.ver", APPLICATION_NAME, (k==0)?"":"_", - (k==0)?"":channel[k], archname[GetCpuArch()], os_version.dwMajorVersion, os_version.dwMinorVersion); + static_sprintf(urlpath, "%s%s%s_win_%s_%lu.%lu.ver", APPLICATION_NAME, (k == 0) ? "": "_", + (k == 0) ? "" : channel[k], GetAppArchName(), os_version.dwMajorVersion, os_version.dwMinorVersion); vuprintf("Base update check: %s", urlpath); - for (i=0, j=(int)safe_strlen(urlpath)-5; (j>0)&&(i 0) && (i < ARRAYSIZE(verpos)); j--) { if ((urlpath[j] == '.') || (urlpath[j] == '_')) { verpos[i++] = j; } diff --git a/src/parser.c b/src/parser.c index d854e974..d3ebe816 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * Elementary Unicode compliant find/replace parser - * Copyright © 2012-2022 Pete Batard + * Copyright © 2012-2023 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 @@ -914,14 +914,13 @@ void parse_update(char* buf, size_t len) char allowed_rtf_chars[] = "abcdefghijklmnopqrstuvwxyz|~-_:*'"; char allowed_std_chars[] = "\r\n ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"$%^&+=<>(){}[].,;#@/?"; char download_url_name[24]; - char *arch_names[5] = { "unknown", "x86", "x64", "arm", "arm64" }; // strchr includes the NUL terminator in the search, so take care of backslash before NUL if ((buf == NULL) || (len < 2) || (len > 64 * KB) || (buf[len-1] != 0) || (buf[len-2] == '\\')) return; // Sanitize the data - Not a silver bullet, but it helps len = safe_strlen(buf)+1; // Someone may be inserting NULs - for (i=0; i