freemyipod r954 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r953‎ | r954 | r955 >
Date:17:29, 16 June 2014
Author:theseven
Status:new
Tags:
Comment:
installer-ipodclassic: Fix 0x800 bytes of garbage data being written to boot flash
Modified paths:
  • /apps/installer-ipodclassic/main.c (modified) (history)
  • /apps/installer-ipodnano2g/main.c (modified) (history)

Diff [purge]

Index: apps/installer-ipodclassic/main.c
@@ -229,20 +229,19 @@
230230 if (flags & 8)
231231 {
232232 offs = 0x800;
233 - size = ((size + 0xf) & ~0xf) + offs;
 233+ size = ((size + 0xf) & ~0xf);
234234 }
235235 if (flags & 1)
236236 {
237 - endptr -= ((size + 0xfff) & ~0xfff);
238 - memcpy(&norbuf[endptr + offs], data, size);
 237+ endptr -= ((offs + size + 0xfff) & ~0xfff);
239238 file = endptr;
240239 }
241240 else
242241 {
243 - memcpy(&norbuf[beginptr + offs], data, size);
244242 file = beginptr;
245 - beginptr += ((size + 0xfff) & ~0xfff);
 243+ beginptr += ((offs + size + 0xfff) & ~0xfff);
246244 }
 245+ memcpy(&norbuf[file + offs], data, size);
247246 if (!(flags & 4))
248247 {
249248 if (dirptr >= 0x2000)
@@ -255,7 +254,6 @@
256255 }
257256 if (flags & 8)
258257 {
259 - size -= offs;
260258 memset(&norbuf[file], 0, 0x800);
261259 memcpy(&norbuf[file], "87021.0\x01", 8);
262260 *((uint32_t*)&norbuf[file + 0xc]) = size;
Index: apps/installer-ipodnano2g/main.c
@@ -695,15 +695,14 @@
696696 if (flags & 1)
697697 {
698698 endptr -= ((size + 0xfff) & ~0xfff);
699 - memcpy(&norbuf[endptr], data, size);
700699 file = endptr;
701700 }
702701 else
703702 {
704 - memcpy(&norbuf[beginptr], data, size);
705703 file = beginptr;
706704 beginptr += ((size + 0xfff) & ~0xfff);
707705 }
 706+ memcpy(&norbuf[file], data, size);
708707 if (!(flags & 4))
709708 {
710709 if (dirptr >= 0x1000)

Follow-up revisions

RevisionCommit summaryAuthorDate
r958installer-ipodclassic: Un-revert r954theseven19:32, 16 June 2014