On Jan 25, 2007, at 3:58 PM, Rosyna wrote:
> Well, no, it wouldn't break it. That's what the check for the
> extension of "sucatalog" is for. If the file doesn't have that
> extension, SWUP never actually accesses the file at all and just
> displays the file name in an error dialog.
> Try dragging any arbitrary file onto the SWUP application while
> holding down the command and option keys on the keyboard.
> I guess my point is that the disassembly you posted never shows the
> file being accessed if it doesn't have a sucatalog extension. So
> changing the file path is safe since it is just being using for
> displaying an error.
Commented assembly; looks like the case to me. Anyone want to review
to make sure I'm not missing a jmp somewhere?
If not, then I'll roll together the fix Rosyna suggested:
> An outside fixer would probably have to patch - (BOOL) [SUAppDelegate
> application:(NSApplication *)sender openFile:(NSString *)filename] to
> check the extension of the filename. If it isn't @"sucatalog", then
> modificate the filename string to convert all the %'s in the
> lastPathComponent portion to %%. Then just call the original function.
0x00005ece: push %ebp
0x00005ecf: mov %esp,%ebp
0x00005ed1: push %edi
0x00005ed2: push %esi
0x00005ed3: push %ebx
0x00005ed4: sub $0x3c,%esp
0x00005ed7: mov 20(%ebp),%edi
0x00005eda: mov 0x11704,%eax
0x00005edf: mov %eax,4(%esp)
0x00005ee3: mov %edi,(%esp)
0x00005ee6: call 0x10057 <dyld_stub_objc_msgSend> -[NSString
pathExtension] for file path
0x00005eeb: movl $0xf36c,8(%esp) <-- arg3, CFSTR("sucatalog")
0x00005ef3: mov 71108,%edx <-- arg2, isEqualToString:
0x00005ef9: mov %edx,4(%esp)
0x00005efd: mov %eax,(%esp) <-- arg1, result of pathExtensions
0x00005f00: call 0x10057 <dyld_stub_objc_msgSend> -[NSString
isEqualToString:]
0x00005f05: test %al,%al
0x00005f07: je 0x5fee <-- if file extension is not
sucatalog, jump to 0x5fee (error handler)
0x00005f0d: mov %edi,8(%esp)
0x00005f11: mov 0x11700,%eax
0x00005f16: mov %eax,4(%esp)
0x00005f1a: mov 0x11940,%eax
0x00005f1f: mov %eax,(%esp)
0x00005f22: call 0x10057 <dyld_stub_objc_msgSend>
0x00005f27: mov 71420,%edx
0x00005f2d: mov %edx,4(%esp)
0x00005f31: mov %eax,(%esp)
0x00005f34: call 0x10057 <dyld_stub_objc_msgSend>
0x00005f39: mov %eax,%edi
0x00005f3b: mov 0x116f8,%eax
0x00005f40: mov %eax,4(%esp)
0x00005f44: mov 0x1198c,%eax
0x00005f49: mov %eax,(%esp)
0x00005f4c: call 0x10057 <dyld_stub_objc_msgSend>
0x00005f51: mov %eax,%esi
0x00005f53: mov 0x10038,%eax
0x00005f58: mov (%eax),%eax
0x00005f5a: mov %eax,8(%esp)
0x00005f5e: mov 0x116f4,%eax
0x00005f63: mov %eax,4(%esp)
0x00005f67: mov %esi,(%esp)
0x00005f6a: call 0x10057 <dyld_stub_objc_msgSend>
0x00005f6f: mov %eax,%edx
0x00005f71: test %eax,%eax
0x00005f73: je 0x5f83
0x00005f75: mov 0x116f0,%eax
0x00005f7a: mov %eax,4(%esp)
0x00005f7e: mov %edx,(%esp)
0x00005f81: jmp 0x5f94
0x00005f83: mov 0x11654,%eax
0x00005f88: mov %eax,4(%esp)
0x00005f8c: mov 0x11988,%eax
0x00005f91: mov %eax,(%esp)
0x00005f94: call 0x10057 <dyld_stub_objc_msgSend>
0x00005f99: mov %eax,%ebx
0x00005f9b: movl $0xf37c,12(%esp)
0x00005fa3: mov %edi,8(%esp)
0x00005fa7: mov 0x116ec,%eax
0x00005fac: mov %eax,4(%esp)
0x00005fb0: mov %ebx,(%esp)
0x00005fb3: call 0x10057 <dyld_stub_objc_msgSend>
0x00005fb8: mov 0x10038,%eax
0x00005fbd: mov (%eax),%eax
0x00005fbf: mov %eax,12(%esp)
0x00005fc3: mov %ebx,8(%esp)
0x00005fc7: mov 0x116e8,%eax
0x00005fcc: mov %eax,4(%esp)
0x00005fd0: mov %esi,(%esp)
0x00005fd3: call 0x10057 <dyld_stub_objc_msgSend>
0x00005fd8: mov 0x1147c,%eax
0x00005fdd: mov %eax,4(%esp)
0x00005fe1: mov %ebx,(%esp)
0x00005fe4: call 0x10057 <dyld_stub_objc_msgSend>
0x00005fe9: jmp 0x612a
<-- Jumped if file extension is not sucatalog
0x00005fee: mov %edi,8(%esp) <-- arg3, file path
0x00005ff2: mov 0x116e4,%eax
0x00005ff7: mov %eax,4(%esp) <-- arg2,
productsWithContentsOfFile:
0x00005ffb: mov 0x11984,%eax <-- arg1, SUCatalog
0x00006000: mov %eax,(%esp)
0x00006003: call 0x10057 <dyld_stub_objc_msgSend>
0x00006008: test %eax,%eax
0x0000600a: jne 0x612e <-- If null was returned, jump to 0x612e
0x00006010: mov 0x11490,%eax <-- arg2, mainBundle
0x00006015: mov %eax,4(%esp)
0x00006019: mov 0x11930,%eax <-- arg1, application bundle?
0x0000601e: mov %eax,(%esp)
0x00006021: call 0x10057 <dyld_stub_objc_msgSend>
0x00006026: movl $0x0,16(%esp) <-- arg5, NULL
0x0000602e: movl $0xf38c,12(%esp) <-- arg4, ""
0x00006036: movl $0xf39c,8(%esp) <-- arg3, "Software Update
can't open the file <name>."
0x0000603e: mov 70728,%edx <-- arg2,
localizedStringForKey:value:table:
0x00006044: mov %edx,4(%esp)
0x00006048: mov %eax,(%esp) <-- arg1, the main bundle from
above
0x0000604b: call 0x10057 <dyld_stub_objc_msgSend> -[NSbundle
localizedStringForKey:value:table]
0x00006050: mov %eax,%esi
0x00006052: mov 0x11490,%eax <-- arg2, "mainBundle"
0x00006057: mov %eax,4(%esp)
0x0000605b: mov 0x11930,%eax <-- arg1, application main bundle
0x00006060: mov %eax,(%esp)
0x00006063: call 0x10057 <dyld_stub_objc_msgSend>
0x00006068: movl $0x0,16(%esp) <-- arg5, NULL
0x00006070: movl $0xf38c,12(%esp) <-- arg4, ""
0x00006078: movl $0xf3ac,8(%esp) <-- arg3, "The catalog file
could not be opened."
0x00006080: mov 70728,%edx <-- arg2,
localizedStringForKey:value:table:
0x00006086: mov %edx,4(%esp)
0x0000608a: mov %eax,(%esp) arg1, application main bundle
0x0000608d: call 0x10057 <dyld_stub_objc_msgSend> -[NSbundle
localizedStringForKey:value:table]
0x00006092: mov %eax,-28(%ebp) <-- copy the result to our
stack -28($ebp)
0x00006095: mov 71976,%ebx <-- NSString class (not used for
the immediate msgSend call)
0x0000609b: mov 0x116e0,%eax <-- arg2, lastPathComponent
0x000060a0: mov %eax,4(%esp)
0x000060a4: mov %edi,(%esp) <-- arg1, file path
0x000060a7: call 0x10057 <dyld_stub_objc_msgSend> -[NSString
lastPathComponent]
0x000060ac: mov %eax,12(%esp) <-- arg4, Final path component
of file path
0x000060b0: mov %esi,8(%esp) <-- arg3, localized "Software
Update can't open the file <name>."
0x000060b4: mov 0x11434,%eax <-- arg2, stringWithFormat:
0x000060b9: mov %eax,4(%esp)
0x000060bd: mov %ebx,(%esp) <-- arg1, NSString class
0x000060c0: call 0x10057 <dyld_stub_objc_msgSend> +[NSString
stringWithFormat:...]
0x000060c5: mov %eax,%ebx <-- Save the localized error
message for later
0x000060c7: mov 0x11490,%eax <-- arg2, "mainBundle"
0x000060cc: mov %eax,4(%esp)
0x000060d0: mov 0x11930,%eax <-- arg1, application main bundle
0x000060d5: mov %eax,(%esp)
0x000060d8: call 0x10057 <dyld_stub_objc_msgSend> <-- Retrieve
the main bundle. Again. Yeesh.
0x000060dd: movl $0x0,16(%esp) <-- arg5, NULL
0x000060e5: movl $0xf38c,12(%esp) <-- arg4, @""
0x000060ed: movl $0xf3bc,8(%esp) <-- arg3, @"OK"
0x000060f5: mov 70728,%edx <-- arg2,
"localizedStringForKey:value:table:"
0x000060fb: mov %edx,4(%esp)
0x000060ff: mov %eax,(%esp) <-- &n