|
...
|
...
|
@@ -150,6 +150,10 @@ int cli_scandmg(cli_ctx *ctx)
|
|
150
|
150
|
return CL_EFORMAT;
|
|
151
|
151
|
}
|
|
152
|
152
|
cli_dbgmsg("cli_scandmg: XML offset %lu len %d\n", (unsigned long)hdr.xmlOffset, (int)hdr.xmlLength);
|
|
|
153
|
+ if (hdr.xmlLength == 0) {
|
|
|
154
|
+ cli_dbgmsg("cli_scandmg: Embedded XML length is zero.\n");
|
|
|
155
|
+ return CL_EFORMAT;
|
|
|
156
|
+ }
|
|
153
|
157
|
|
|
154
|
158
|
/* Create temp folder for contents */
|
|
155
|
159
|
if (!(dirname = cli_gentemp(ctx->engine->tmpdir))) {
|
|
...
|
...
|
@@ -1040,6 +1044,9 @@ static int dmg_extract_xml(cli_ctx *ctx, char *dir, struct dmg_koly_block *hdr)
|
|
1040
|
1040
|
|
|
1041
|
1041
|
/* Write out TOC XML */
|
|
1042
|
1042
|
if ((ofd = open(xmlfile, O_CREAT|O_RDWR|O_EXCL|O_TRUNC|O_BINARY, S_IRWXU)) < 0) {
|
|
|
1043
|
+ cli_errmsg("cli_scandmg: Can't create temporary file %s: %s\n",
|
|
|
1044
|
+ xmlfile, cli_strerror(errno, err, sizeof(err)));
|
|
|
1045
|
+ free(xmlfile);
|
|
1043
|
1046
|
return CL_ETMPFILE;
|
|
1044
|
1047
|
}
|
|
1045
|
1048
|
|