summaryrefslogtreecommitdiffstats
path: root/utils/zenutils/source
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-01-23 17:44:34 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-01-23 17:44:34 +0000
commit42f2dd8961a64d9f225f72747668deeee1142cb0 (patch)
treef097eab776d746da8784330a57df432f24d5d298 /utils/zenutils/source
parent44554e60756288e99bf664ea87f86dc482006eff (diff)
downloadrockbox-42f2dd8961a64d9f225f72747668deeee1142cb0.tar.gz
rockbox-42f2dd8961a64d9f225f72747668deeee1142cb0.tar.bz2
rockbox-42f2dd8961a64d9f225f72747668deeee1142cb0.zip
ZenUtils: fix offset detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19825 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/zenutils/source')
-rw-r--r--utils/zenutils/source/shared/updater.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/zenutils/source/shared/updater.cpp b/utils/zenutils/source/shared/updater.cpp
index 8db72d0c4c..d6106c250d 100644
--- a/utils/zenutils/source/shared/updater.cpp
+++ b/utils/zenutils/source/shared/updater.cpp
@@ -53,10 +53,11 @@ dword zen::find_firmware_offset(byte* buffer, size_t len)
for (dword i = 0; i < static_cast<dword>(len); i += 4)
{
dword size = *(dword*)&buffer[i];
- 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 (size != 0
+ && buffer[i + 4] != 0
+ && buffer[i + 4 + 1] != 0
+ && buffer[i + 4 + 2] != 0
+ && buffer[i + 4 + 3] != 0)
{
return i;
}