write_file(extracted_file(fent->name), fent->start, fent->length);
if (*((unsigned int*)fent->start) == LZ_MAGIC) {
char *lzname;
+ unsigned char *outbuf;
+ unsigned int outlen;
if ((lzname = strdup(fent->name)) == NULL) {
perror("strdup");
printf("%s: packed file found, ", lzname);
- extract_lz_file(fent->start, (unsigned char*)lzname, 0);
+ outbuf = extract_lz_file(fent->start, &outlen, 0);
+ write_file(extracted_file((char*)lzname), outbuf, outlen);
+
+ free(outbuf);
free(lzname);
} else if (!strcmp(fent->name, "firmware")) {
unsigned char *lzpos;
memcpy(lzname + strlen(lzname), lzpos - 4, 4);
lzpos += 4;
if (*((unsigned int*)(lzpos)) == LZ_MAGIC) {
- printf("%s: compressed firmware part found, ", lzname);
- extract_lz_file(lzpos, (unsigned char*)lzname, 1);
+ unsigned char *outbuf;
+ unsigned int outlen;
+
+ printf("%s: compressed firmware part found", lzname);
+ outbuf = extract_lz_file(lzpos, &outlen, 1);
+ printf(", ");
+ write_file(extracted_file((char*)lzname), outbuf, outlen);
+
+ free(outbuf);
}
}
} else {