diff --git a/docs/CREDITS b/docs/CREDITS index 74f359c2c3..8e087e0655 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -411,6 +411,7 @@ Tadayuki Nishizono Jun Gu Daniel Weck Clément Pit-Claudel +Jelle Geerts The libmad team The wavpack team diff --git a/utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/win.h b/utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/win.h index d578085c29..04a08c609f 100644 --- a/utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/win.h +++ b/utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/win.h @@ -39,7 +39,7 @@ # else # error Unknown CPU type in MetroWerks CodeWarrior # endif -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) || defined(__MINGW32__) # if defined(_M_IX86) # define WORDS_BIGENDIAN 0 # define ROTL32(x, s) _rotl(x, s) @@ -51,7 +51,7 @@ # error Unknown compiler for WIN32 #endif -#if defined(_MSC_VER) || __MWERKS__ +#if defined(_MSC_VER) || defined(__MINGW32__) || __MWERKS__ #include #include #include @@ -128,6 +128,8 @@ typedef unsigned __int64 uint64_t; typedef long off_t; +#elif defined(__MINGW32__) +#include #endif #define MP_WBITS 32U diff --git a/utils/zenutils/source/shared/updater.cpp b/utils/zenutils/source/shared/updater.cpp index 3944863533..7efac3d373 100644 --- a/utils/zenutils/source/shared/updater.cpp +++ b/utils/zenutils/source/shared/updater.cpp @@ -50,19 +50,18 @@ const char* zen::find_firmware_key(const byte* buffer, size_t len) dword zen::find_firmware_offset(byte* buffer, size_t len) { - for (dword i = 0; i < static_cast(len); i += 0x10) + for (dword i = 0; i < static_cast(len); i += 4) { dword size = *(dword*)&buffer[i]; - if (size < (i + len) && size > (len >> 1)) + if (buffer[i + sizeof(dword)] != 0 + && buffer[i + sizeof(dword) + 1] != 0 + && buffer[i + sizeof(dword) + 2] != 0 + && buffer[i + sizeof(dword) + 3] != 0) { - if (buffer[i + sizeof(dword)] != 0 - && buffer[i + sizeof(dword) + 1] != 0 - && buffer[i + sizeof(dword) + 2] != 0 - && buffer[i + sizeof(dword) + 3] != 0) - { - return i; - } + return i; } + if(i > 0xFF) /* Arbitrary guess */ + return 0; } return 0; } @@ -105,7 +104,6 @@ bool zen::crypt_firmware(const char* key, byte* buffer, size_t len) unsigned int tmp = 0; int key_length = strlen(key); - strcpy(key_cpy, key); for(i=0; i < strlen(key); i++) key_cpy[i] = key[i] - 1;