diff options
author | Nikias Bassen | 2013-10-02 19:29:04 +0200 |
---|---|---|
committer | Nikias Bassen | 2013-10-02 19:29:04 +0200 |
commit | b040d1b5f4732a431c1d900b55d6bbd3684f6c74 (patch) | |
tree | 90707c0dfebcddb763ceb322f61b2a3ca4a95abd | |
parent | 4f6e61eb9ec0af09a85bcbd83e6897782eb669aa (diff) | |
download | idevicerestore-b040d1b5f4732a431c1d900b55d6bbd3684f6c74.tar.gz idevicerestore-b040d1b5f4732a431c1d900b55d6bbd3684f6c74.tar.bz2 |
ipsw: change buffers to use type unsigned char*
-rw-r--r-- | src/idevicerestore.c | 8 | ||||
-rw-r--r-- | src/idevicerestore.h | 2 | ||||
-rw-r--r-- | src/ipsw.c | 21 | ||||
-rw-r--r-- | src/ipsw.h | 2 | ||||
-rw-r--r-- | src/restore.c | 16 |
5 files changed, 26 insertions, 23 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index f64db02..ca760d4 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -242,8 +242,8 @@ int idevicerestore_start(struct idevicerestore_client_t* client) char wtfname[256]; sprintf(wtfname, "Firmware/dfu/WTF.s5l%04xxall.RELEASE.dfu", cpid); - char* wtftmp = NULL; - uint32_t wtfsize = 0; + unsigned char* wtftmp = NULL; + unsigned int wtfsize = 0; ipsw_extract_to_memory(wtfipsw, wtfname, &wtftmp, &wtfsize); if (!wtftmp) { error("ERROR: Could not extract WTF\n"); @@ -392,7 +392,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client) char *files[16]; char *fmanifest = NULL; uint32_t msize = 0; - if (ipsw_extract_to_memory(client->ipsw, tmpstr, &fmanifest, &msize) < 0) { + if (ipsw_extract_to_memory(client->ipsw, tmpstr, (unsigned char**)&fmanifest, &msize) < 0) { error("ERROR: could not extract %s from IPSW\n", tmpstr); return -1; } @@ -1425,7 +1425,7 @@ int build_manifest_get_identity_count(plist_t build_manifest) { return plist_array_get_size(build_identities_array); } -int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* component, const char* path, char** data, uint32_t* size) { +int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* component, const char* path, unsigned char** data, unsigned int* size) { img3_file* img3 = NULL; unsigned int component_size = 0; unsigned char* component_data = NULL; diff --git a/src/idevicerestore.h b/src/idevicerestore.h index 44e3350..a04ec66 100644 --- a/src/idevicerestore.h +++ b/src/idevicerestore.h @@ -88,7 +88,7 @@ int build_manifest_get_build_count(plist_t build_manifest); void build_identity_print_information(plist_t build_identity); int build_identity_get_component_path(plist_t build_identity, const char* component, char** path); int ipsw_extract_filesystem(const char* ipsw, plist_t build_identity, char** filesystem); -int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* component, const char* path, char** data, uint32_t* size); +int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* component, const char* path, unsigned char** data, unsigned int* size); const char* get_component_name(const char* filename); #ifdef __cplusplus @@ -174,7 +174,7 @@ int ipsw_file_exists(const char* ipsw, const char* infile) return 0; } -int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, uint32_t* psize) { +int ipsw_extract_to_memory(const char* ipsw, const char* infile, unsigned char** pbuffer, unsigned int* psize) { ipsw_archive* archive = ipsw_open(ipsw); if (archive == NULL || archive->zip == NULL) { error("ERROR: Invalid archive\n"); @@ -201,7 +201,7 @@ int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, } int size = zstat.size; - char* buffer = (unsigned char*) malloc(size+1); + unsigned char* buffer = (unsigned char*) malloc(size+1); if (buffer == NULL) { error("ERROR: Out of memory\n"); zip_fclose(zfile); @@ -226,15 +226,16 @@ int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, } int ipsw_extract_build_manifest(const char* ipsw, plist_t* buildmanifest, int *tss_enabled) { - int size = 0; - char* data = NULL; + unsigned int size = 0; + unsigned char* data = NULL; *tss_enabled = 0; /* older devices don't require personalized firmwares and use a BuildManifesto.plist */ if (ipsw_file_exists(ipsw, "BuildManifesto.plist") == 0) { if (ipsw_extract_to_memory(ipsw, "BuildManifesto.plist", &data, &size) == 0) { - plist_from_xml(data, size, buildmanifest); + plist_from_xml((char*)data, size, buildmanifest); + free(data); return 0; } } @@ -245,7 +246,8 @@ int ipsw_extract_build_manifest(const char* ipsw, plist_t* buildmanifest, int *t /* whereas newer devices do not require personalized firmwares and use a BuildManifest.plist */ if (ipsw_extract_to_memory(ipsw, "BuildManifest.plist", &data, &size) == 0) { *tss_enabled = 1; - plist_from_xml(data, size, buildmanifest); + plist_from_xml((char*)data, size, buildmanifest); + free(data); return 0; } @@ -253,11 +255,12 @@ int ipsw_extract_build_manifest(const char* ipsw, plist_t* buildmanifest, int *t } int ipsw_extract_restore_plist(const char* ipsw, plist_t* restore_plist) { - int size = 0; - char* data = NULL; + unsigned int size = 0; + unsigned char* data = NULL; if (ipsw_extract_to_memory(ipsw, "Restore.plist", &data, &size) == 0) { - plist_from_xml(data, size, restore_plist); + plist_from_xml((char*)data, size, restore_plist); + free(data); return 0; } @@ -41,7 +41,7 @@ typedef struct { int ipsw_get_file_size(const char* ipsw, const char* infile, off_t* size); int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfile); -int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, uint32_t* psize); +int ipsw_extract_to_memory(const char* ipsw, const char* infile, unsigned char** pbuffer, unsigned int* psize); int ipsw_extract_build_manifest(const char* ipsw, plist_t* buildmanifest, int *tss_enabled); int ipsw_extract_restore_plist(const char* ipsw, plist_t* restore_plist); void ipsw_free_file(ipsw_file* file); diff --git a/src/restore.c b/src/restore.c index 1a01582..607f95f 100644 --- a/src/restore.c +++ b/src/restore.c @@ -765,7 +765,7 @@ int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_cl int restore_send_kernelcache(restored_client_t restore, struct idevicerestore_client_t* client, plist_t build_identity) { unsigned int size = 0; - char* data = NULL; + unsigned char* data = NULL; char* path = NULL; plist_t blob = NULL; plist_t dict = NULL; @@ -793,7 +793,7 @@ int restore_send_kernelcache(restored_client_t restore, struct idevicerestore_cl } dict = plist_new_dict(); - blob = plist_new_data(data, size); + blob = plist_new_data((char*)data, size); plist_dict_insert_item(dict, "KernelCacheFile", blob); info("Sending KernelCache now...\n"); @@ -816,14 +816,14 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* char firmware_path[256]; char manifest_file[256]; unsigned int manifest_size = 0; - char* manifest_data = NULL; + unsigned char* manifest_data = NULL; char firmware_filename[256]; unsigned int llb_size = 0; - char* llb_data = NULL; + unsigned char* llb_data = NULL; plist_t dict = NULL; char* filename = NULL; unsigned int nor_size = 0; - char* nor_data = NULL; + unsigned char* nor_data = NULL; plist_t norimage_array = NULL; restored_error_t ret = RESTORE_E_SUCCESS; @@ -870,11 +870,11 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* } dict = plist_new_dict(); - plist_dict_insert_item(dict, "LlbImageData", plist_new_data(llb_data, (uint64_t) llb_size)); + plist_dict_insert_item(dict, "LlbImageData", plist_new_data((char*)llb_data, (uint64_t) llb_size)); norimage_array = plist_new_array(); - filename = strtok(manifest_data, "\r\n"); + filename = strtok((char*)manifest_data, "\r\n"); while (filename != NULL) { if (!strncmp("LLB", filename, 3)) { // skip LLB, it's already passed in LlbImageData @@ -888,7 +888,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* break; } - plist_array_append_item(norimage_array, plist_new_data(nor_data, (uint64_t)nor_size)); + plist_array_append_item(norimage_array, plist_new_data((char*)nor_data, (uint64_t)nor_size)); free(nor_data); nor_data = NULL; nor_size = 0; |