fixed memory bug with itunespwn

This commit is contained in:
planetbeing 2008-07-25 18:49:34 +00:00
Родитель 0150f5b25b
Коммит 4f7ae542ec
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -1,6 +1,7 @@
#include <windows.h>
#include <shlobj.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@ -8,7 +9,7 @@
#define SHGFP_TYPE_CURRENT 0
char restorePlist[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>DeviceClass</key>\n <string>iPhone</string>\n <key>DeviceMap</key>\n <array/>\n <key>FirmwareDirectory</key>\n <string>Firmware</string>\n <key>ProductBuildVersion</key>\n <string>5A348</string>\n <key>ProductType</key>\n <string>iPhone1,1</string>\n <key>ProductVersion</key>\n <string>2.0</string>\n <key>SupportedProductTypeIDs</key>\n <dict>\n <key>DFU</key>\n <array>\n <integer>304218112</integer>\n </array>\n <key>Recovery</key>\n <array/>\n </dict>\n</dict>\n</plist>\n";
const char restorePlist[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>DeviceClass</key>\n <string>iPhone</string>\n <key>DeviceMap</key>\n <array/>\n <key>FirmwareDirectory</key>\n <string>Firmware</string>\n <key>ProductBuildVersion</key>\n <string>5A348</string>\n <key>ProductType</key>\n <string>iPhone1,1</string>\n <key>ProductVersion</key>\n <string>2.0</string>\n <key>SupportedProductTypeIDs</key>\n <dict>\n <key>DFU</key>\n <array>\n <integer>304218112</integer>\n </array>\n <key>Recovery</key>\n <array/>\n </dict>\n</dict>\n</plist>\n";
int main(int argc, char* argv[]) {
@ -28,9 +29,13 @@ int main(int argc, char* argv[]) {
strcat(path, "\\x12220000_4_Recovery.ipsw");
void* buffer;
buffer = malloc(sizeof(restorePlist) - 1);
memcpy(buffer, restorePlist, sizeof(restorePlist) - 1);
OutputState* data = NULL;
loadZipFile(argv[1], &data, "Firmware/dfu/WTF.s5l8900xall.RELEASE.dfu");
addToOutput(&data, "Restore.plist", restorePlist, sizeof(restorePlist) - 1);
addToOutput(&data, "Restore.plist", buffer, sizeof(restorePlist) - 1);
writeOutput(&data, path);
return 0;