... | ... |
@@ -1,4 +1,4 @@ |
1 |
-# Makefile.in generated by automake 1.14 from Makefile.am. |
|
1 |
+# Makefile.in generated by automake 1.14.1 from Makefile.am. |
|
2 | 2 |
# @configure_input@ |
3 | 3 |
|
4 | 4 |
# Copyright (C) 1994-2013 Free Software Foundation, Inc. |
... | ... |
@@ -955,9 +955,10 @@ distcheck: dist |
955 | 955 |
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ |
956 | 956 |
&& am__cwd=`pwd` \ |
957 | 957 |
&& $(am__cd) $(distdir)/_build \ |
958 |
- && ../configure --srcdir=.. --prefix="$$dc_install_base" \ |
|
958 |
+ && ../configure \ |
|
959 | 959 |
$(AM_DISTCHECK_CONFIGURE_FLAGS) \ |
960 | 960 |
$(DISTCHECK_CONFIGURE_FLAGS) \ |
961 |
+ --srcdir=.. --prefix="$$dc_install_base" \ |
|
961 | 962 |
&& $(MAKE) $(AM_MAKEFLAGS) \ |
962 | 963 |
&& $(MAKE) $(AM_MAKEFLAGS) dvi \ |
963 | 964 |
&& $(MAKE) $(AM_MAKEFLAGS) check \ |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-# generated automatically by aclocal 1.14 -*- Autoconf -*- |
|
1 |
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*- |
|
2 | 2 |
|
3 | 3 |
# Copyright (C) 1996-2013 Free Software Foundation, Inc. |
4 | 4 |
|
... | ... |
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], |
35 | 35 |
[am__api_version='1.14' |
36 | 36 |
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
37 | 37 |
dnl require some minimum version. Point them to the right macro. |
38 |
-m4_if([$1], [1.14], [], |
|
38 |
+m4_if([$1], [1.14.1], [], |
|
39 | 39 |
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
40 | 40 |
]) |
41 | 41 |
|
... | ... |
@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) |
51 | 51 |
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. |
52 | 52 |
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
53 | 53 |
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
54 |
-[AM_AUTOMAKE_VERSION([1.14])dnl |
|
54 |
+[AM_AUTOMAKE_VERSION([1.14.1])dnl |
|
55 | 55 |
m4_ifndef([AC_AUTOCONF_VERSION], |
56 | 56 |
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
57 | 57 |
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
... | ... |
@@ -536,7 +536,11 @@ version.h: version.h.tmp |
536 | 536 |
cp version.h.static version.h;\ |
537 | 537 |
elif ! diff $@ version.h.tmp >/dev/null 2>/dev/null; then\ |
538 | 538 |
cp version.h.tmp $@;\ |
539 |
- fi |
|
539 |
+ fi;\ |
|
540 |
+ if test -f $(top_srcdir)/libclamav/version.h &&\ |
|
541 |
+ ! diff $(top_srcdir)/libclamav/version.h version.h.tmp >/dev/null 2>/dev/null; then\ |
|
542 |
+ cp version.h.tmp $(top_srcdir)/libclamav/version.h;\ |
|
543 |
+ fi |
|
540 | 544 |
|
541 | 545 |
version.h.tmp: |
542 | 546 |
$(AM_V_GEN) test -f version.h || touch version.h;\ |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-# Makefile.in generated by automake 1.14 from Makefile.am. |
|
1 |
+# Makefile.in generated by automake 1.14.1 from Makefile.am. |
|
2 | 2 |
# @configure_input@ |
3 | 3 |
|
4 | 4 |
# Copyright (C) 1994-2013 Free Software Foundation, Inc. |
... | ... |
@@ -3420,7 +3420,11 @@ version.h: version.h.tmp |
3420 | 3420 |
cp version.h.static version.h;\ |
3421 | 3421 |
elif ! diff $@ version.h.tmp >/dev/null 2>/dev/null; then\ |
3422 | 3422 |
cp version.h.tmp $@;\ |
3423 |
- fi |
|
3423 |
+ fi;\ |
|
3424 |
+ if test -f $(top_srcdir)/libclamav/version.h &&\ |
|
3425 |
+ ! diff $(top_srcdir)/libclamav/version.h version.h.tmp >/dev/null 2>/dev/null; then\ |
|
3426 |
+ cp version.h.tmp $(top_srcdir)/libclamav/version.h;\ |
|
3427 |
+ fi |
|
3424 | 3428 |
|
3425 | 3429 |
version.h.tmp: |
3426 | 3430 |
$(AM_V_GEN) test -f version.h || touch version.h;\ |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-# Makefile.in generated by automake 1.14 from Makefile.am. |
|
1 |
+# Makefile.in generated by automake 1.14.1 from Makefile.am. |
|
2 | 2 |
# @configure_input@ |
3 | 3 |
|
4 | 4 |
# Copyright (C) 1994-2013 Free Software Foundation, Inc. |
... | ... |
@@ -5653,9 +5653,10 @@ distcheck: dist |
5653 | 5653 |
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ |
5654 | 5654 |
&& am__cwd=`pwd` \ |
5655 | 5655 |
&& $(am__cd) $(distdir)/_build \ |
5656 |
- && ../configure --srcdir=.. --prefix="$$dc_install_base" \ |
|
5656 |
+ && ../configure \ |
|
5657 | 5657 |
$(AM_DISTCHECK_CONFIGURE_FLAGS) \ |
5658 | 5658 |
$(DISTCHECK_CONFIGURE_FLAGS) \ |
5659 |
+ --srcdir=.. --prefix="$$dc_install_base" \ |
|
5659 | 5660 |
&& $(MAKE) $(AM_MAKEFLAGS) \ |
5660 | 5661 |
&& $(MAKE) $(AM_MAKEFLAGS) dvi \ |
5661 | 5662 |
&& $(MAKE) $(AM_MAKEFLAGS) check \ |
... | ... |
@@ -5745,8 +5746,8 @@ maintainer-clean-generic: |
5745 | 5745 |
@echo "This command is intended for maintainers to use" |
5746 | 5746 |
@echo "it deletes files that may require special tools to rebuild." |
5747 | 5747 |
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) |
5748 |
-@BUILD_EXTERNAL_LLVM_TRUE@distclean-local: |
|
5749 | 5748 |
@BUILD_EXTERNAL_LLVM_TRUE@clean-local: |
5749 |
+@BUILD_EXTERNAL_LLVM_TRUE@distclean-local: |
|
5750 | 5750 |
clean: clean-am |
5751 | 5751 |
|
5752 | 5752 |
clean-am: clean-generic clean-libtool clean-local \ |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-# generated automatically by aclocal 1.14 -*- Autoconf -*- |
|
1 |
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*- |
|
2 | 2 |
|
3 | 3 |
# Copyright (C) 1996-2013 Free Software Foundation, Inc. |
4 | 4 |
|
... | ... |
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], |
35 | 35 |
[am__api_version='1.14' |
36 | 36 |
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
37 | 37 |
dnl require some minimum version. Point them to the right macro. |
38 |
-m4_if([$1], [1.14], [], |
|
38 |
+m4_if([$1], [1.14.1], [], |
|
39 | 39 |
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
40 | 40 |
]) |
41 | 41 |
|
... | ... |
@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) |
51 | 51 |
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. |
52 | 52 |
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
53 | 53 |
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
54 |
-[AM_AUTOMAKE_VERSION([1.14])dnl |
|
54 |
+[AM_AUTOMAKE_VERSION([1.14.1])dnl |
|
55 | 55 |
m4_ifndef([AC_AUTOCONF_VERSION], |
56 | 56 |
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
57 | 57 |
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
... | ... |
@@ -624,9 +624,9 @@ void *mpool_malloc(struct MP *mp, size_t size) { |
624 | 624 |
mp->avail[sbits] = f->u.next.ptr; |
625 | 625 |
/* we always have enough space for this, align_increase ensured that */ |
626 | 626 |
#ifdef _WIN64 |
627 |
- f = (struct FRAG*)(alignto((unsigned long long)f + FRAG_OVERHEAD, align)-FRAG_OVERHEAD); |
|
627 |
+ f = (struct FRAG*)(alignto((unsigned long long)f + FRAG_OVERHEAD, align)-FRAG_OVERHEAD); |
|
628 | 628 |
#else |
629 |
- f = (struct FRAG*)(alignto((unsigned long)f + FRAG_OVERHEAD, align)-FRAG_OVERHEAD); |
|
629 |
+ f = (struct FRAG*)(alignto((unsigned long)f + FRAG_OVERHEAD, align)-FRAG_OVERHEAD); |
|
630 | 630 |
#endif |
631 | 631 |
f->u.a.sbits = sbits; |
632 | 632 |
f->u.a.padding = (char*)f - (char*)fold; |
... | ... |
@@ -78,11 +78,29 @@ static int ooxml_is_int(const char *value, size_t len, int32_t *val) |
78 | 78 |
return 1; |
79 | 79 |
} |
80 | 80 |
|
81 |
+static int ooxml_add_parse_error(json_object *wrkptr, const xmlChar *errstr) |
|
82 |
+{ |
|
83 |
+ json_object *perr; |
|
84 |
+ |
|
85 |
+ if (!wrkptr) |
|
86 |
+ return CL_ENULLARG; |
|
87 |
+ |
|
88 |
+ perr = cli_jsonarray(wrkptr, "ParseErrors"); |
|
89 |
+ if (perr == NULL) { |
|
90 |
+ return CL_EMEM; |
|
91 |
+ } |
|
92 |
+ |
|
93 |
+ return cli_jsonstr(perr, NULL, errstr); |
|
94 |
+} |
|
95 |
+ |
|
81 | 96 |
static int ooxml_parse_value(json_object *wrkptr, const char *arrname, const xmlChar *node_value) |
82 | 97 |
{ |
83 | 98 |
json_object *newobj, *arrobj; |
84 | 99 |
int val; |
85 | 100 |
|
101 |
+ if (!wrkptr) |
|
102 |
+ return CL_ENULLARG; |
|
103 |
+ |
|
86 | 104 |
arrobj = cli_jsonarray(wrkptr, arrname); |
87 | 105 |
if (arrobj == NULL) { |
88 | 106 |
return CL_EMEM; |
... | ... |
@@ -247,7 +265,7 @@ static int ooxml_parse_element(cli_ctx *ctx, xmlTextReaderPtr reader, json_objec |
247 | 247 |
|
248 | 248 |
if (node_type != XML_READER_TYPE_ELEMENT) { |
249 | 249 |
cli_dbgmsg("ooxml_parse_element: first node typed %d, not %d\n", node_type, XML_READER_TYPE_ELEMENT); |
250 |
- return CL_EPARSE; /* first type is not an element */ |
|
250 |
+ return CL_EFORMAT; /* first type is not an element */ |
|
251 | 251 |
} |
252 | 252 |
|
253 | 253 |
node_name = xmlTextReaderConstLocalName(reader); |
... | ... |
@@ -267,7 +285,7 @@ static int ooxml_parse_element(cli_ctx *ctx, xmlTextReaderPtr reader, json_objec |
267 | 267 |
/* generate json object */ |
268 | 268 |
thisjobj = cli_jsonobj(wrkptr, element_tag); |
269 | 269 |
if (!thisjobj) { |
270 |
- return CL_EPARSE; |
|
270 |
+ return CL_EMEM; |
|
271 | 271 |
} |
272 | 272 |
cli_dbgmsg("ooxml_parse_element: generated json object [%s]\n", element_tag); |
273 | 273 |
|
... | ... |
@@ -406,10 +424,8 @@ static int ooxml_parse_document(int fd, cli_ctx *ctx) |
406 | 406 |
|
407 | 407 |
ret = ooxml_parse_element(ctx, reader, ctx->wrkproperty, 0, NULL); |
408 | 408 |
|
409 |
- if (ret != CL_SUCCESS && ret != CL_ETIMEOUT && ret != CL_BREAK) { |
|
409 |
+ if (ret != CL_SUCCESS && ret != CL_ETIMEOUT && ret != CL_BREAK) |
|
410 | 410 |
cli_warnmsg("ooxml_parse_document: encountered issue in parsing properties document\n"); |
411 |
- cli_jsonbool(ctx->wrkproperty, "ParseError", 1); |
|
412 |
- } |
|
413 | 411 |
|
414 | 412 |
xmlTextReaderClose(reader); |
415 | 413 |
xmlFreeTextReader(reader); |
... | ... |
@@ -418,21 +434,35 @@ static int ooxml_parse_document(int fd, cli_ctx *ctx) |
418 | 418 |
|
419 | 419 |
static int ooxml_core_cb(int fd, cli_ctx *ctx) |
420 | 420 |
{ |
421 |
+ int ret; |
|
422 |
+ |
|
421 | 423 |
cli_dbgmsg("in ooxml_core_cb\n"); |
422 |
- return ooxml_parse_document(fd, ctx); |
|
423 |
- //return ooxml_basic_json(fd, ctx, "CoreProperties"); |
|
424 |
+ ret = ooxml_parse_document(fd, ctx); |
|
425 |
+ if (ret == CL_EPARSE) |
|
426 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_CORE_XMLPARSER"); |
|
427 |
+ else if (ret == CL_EFORMAT) |
|
428 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_CORE_MALFORMED"); |
|
429 |
+ |
|
430 |
+ return ret; |
|
424 | 431 |
} |
425 | 432 |
|
426 | 433 |
static int ooxml_extn_cb(int fd, cli_ctx *ctx) |
427 | 434 |
{ |
435 |
+ int ret; |
|
436 |
+ |
|
428 | 437 |
cli_dbgmsg("in ooxml_extn_cb\n"); |
429 |
- return ooxml_parse_document(fd, ctx); |
|
430 |
- //return ooxml_basic_json(fd, ctx, "ExtendedProperties"); |
|
438 |
+ ret = ooxml_parse_document(fd, ctx); |
|
439 |
+ if (ret == CL_EPARSE) |
|
440 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_EXTN_XMLPARSER"); |
|
441 |
+ else if (ret == CL_EFORMAT) |
|
442 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_EXTN_MALFORMED"); |
|
443 |
+ |
|
444 |
+ return ret; |
|
431 | 445 |
} |
432 | 446 |
|
433 | 447 |
static int ooxml_content_cb(int fd, cli_ctx *ctx) |
434 | 448 |
{ |
435 |
- int ret = CL_SUCCESS, tmp, toval = 0; |
|
449 |
+ int ret = CL_SUCCESS, tmp, toval = 0, state; |
|
436 | 450 |
int core=0, extn=0, cust=0, dsig=0; |
437 | 451 |
int mcore=0, mextn=0, mcust=0; |
438 | 452 |
const xmlChar *name, *value, *CT, *PN; |
... | ... |
@@ -444,11 +474,12 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
444 | 444 |
reader = xmlReaderForFd(fd, "[Content_Types].xml", NULL, CLAMAV_MIN_XMLREADER_FLAGS); |
445 | 445 |
if (reader == NULL) { |
446 | 446 |
cli_dbgmsg("ooxml_content_cb: xmlReaderForFd error for ""[Content_Types].xml""\n"); |
447 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_XML_READER_FD"); |
|
447 | 448 |
return CL_SUCCESS; // libxml2 failed! |
448 | 449 |
} |
449 | 450 |
|
450 |
- /* locate core-properties, extended-properties, and custom-properties (optional) */ |
|
451 |
- while (xmlTextReaderRead(reader) == 1) { |
|
451 |
+ /* locate core-properties, extended-properties, and custom-properties (optional) */ |
|
452 |
+ while ((state = xmlTextReaderRead(reader)) == 1) { |
|
452 | 453 |
if (cli_json_timeout_cycle_check(ctx, &toval) != CL_SUCCESS) { |
453 | 454 |
ret = CL_ETIMEOUT; |
454 | 455 |
goto ooxml_content_exit; |
... | ... |
@@ -480,88 +511,107 @@ static int ooxml_content_cb(int fd, cli_ctx *ctx) |
480 | 480 |
if (!CT && !PN) continue; |
481 | 481 |
|
482 | 482 |
if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-package.core-properties+xml")) { |
483 |
- if (!core) { |
|
484 |
- /* default: /docProps/core.xml*/ |
|
485 |
- tmp = unzip_search_single(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
486 |
- if (tmp == CL_ETIMEOUT) { |
|
487 |
- ret = tmp; |
|
488 |
- } |
|
489 |
- else if (tmp != CL_VIRUS) { |
|
490 |
- cli_dbgmsg("cli_process_ooxml: failed to find core properties file \"%s\"!\n", PN); |
|
491 |
- mcore++; |
|
492 |
- } |
|
493 |
- else { |
|
494 |
- cli_dbgmsg("ooxml_content_cb: found core properties file \"%s\" @ %x\n", PN, loff); |
|
495 |
- ret = unzip_single_internal(ctx, loff, ooxml_core_cb); |
|
496 |
- core++; |
|
483 |
+ /* default: /docProps/core.xml*/ |
|
484 |
+ tmp = unzip_search_single(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
485 |
+ if (tmp == CL_ETIMEOUT) { |
|
486 |
+ ret = tmp; |
|
487 |
+ } |
|
488 |
+ else if (tmp != CL_VIRUS) { |
|
489 |
+ cli_dbgmsg("cli_process_ooxml: failed to find core properties file \"%s\"!\n", PN); |
|
490 |
+ mcore++; |
|
491 |
+ } |
|
492 |
+ else { |
|
493 |
+ cli_dbgmsg("ooxml_content_cb: found core properties file \"%s\" @ %x\n", PN, loff); |
|
494 |
+ if (!core) { |
|
495 |
+ tmp = unzip_single_internal(ctx, loff, ooxml_core_cb); |
|
496 |
+ if (tmp == CL_ETIMEOUT || tmp == CL_EMEM) { |
|
497 |
+ ret = tmp; |
|
498 |
+ } |
|
497 | 499 |
} |
500 |
+ core++; |
|
498 | 501 |
} |
499 | 502 |
} |
500 | 503 |
else if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-officedocument.extended-properties+xml")) { |
501 |
- if (!extn) { |
|
502 |
- /* default: /docProps/app.xml */ |
|
503 |
- tmp = unzip_search_single(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
504 |
- if (tmp == CL_ETIMEOUT) { |
|
505 |
- ret = tmp; |
|
506 |
- } |
|
507 |
- else if (tmp != CL_VIRUS) { |
|
508 |
- cli_dbgmsg("cli_process_ooxml: failed to find extended properties file \"%s\"!\n", PN); |
|
509 |
- mextn++; |
|
510 |
- } |
|
511 |
- else { |
|
512 |
- cli_dbgmsg("ooxml_content_cb: found extended properties file \"%s\" @ %x\n", PN, loff); |
|
513 |
- ret = unzip_single_internal(ctx, loff, ooxml_extn_cb); |
|
514 |
- extn++; |
|
504 |
+ /* default: /docProps/app.xml */ |
|
505 |
+ tmp = unzip_search_single(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
506 |
+ if (tmp == CL_ETIMEOUT) { |
|
507 |
+ ret = tmp; |
|
508 |
+ } |
|
509 |
+ else if (tmp != CL_VIRUS) { |
|
510 |
+ cli_dbgmsg("cli_process_ooxml: failed to find extended properties file \"%s\"!\n", PN); |
|
511 |
+ mextn++; |
|
512 |
+ } |
|
513 |
+ else { |
|
514 |
+ cli_dbgmsg("ooxml_content_cb: found extended properties file \"%s\" @ %x\n", PN, loff); |
|
515 |
+ if (!extn) { |
|
516 |
+ tmp = unzip_single_internal(ctx, loff, ooxml_extn_cb); |
|
517 |
+ if (tmp == CL_ETIMEOUT || tmp == CL_EMEM) { |
|
518 |
+ ret = tmp; |
|
519 |
+ } |
|
515 | 520 |
} |
521 |
+ extn++; |
|
516 | 522 |
} |
517 | 523 |
} |
518 | 524 |
else if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-officedocument.custom-properties+xml")) { |
519 |
- if (!cust) { |
|
520 |
- /* default: /docProps/custom.xml */ |
|
521 |
- tmp = unzip_search_single(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
522 |
- if (tmp == CL_ETIMEOUT) { |
|
523 |
- ret = tmp; |
|
524 |
- } |
|
525 |
- else if (tmp != CL_VIRUS) { |
|
526 |
- cli_dbgmsg("cli_process_ooxml: failed to find custom properties file \"%s\"!\n", PN); |
|
527 |
- mcust++; |
|
528 |
- } |
|
529 |
- else { |
|
530 |
- cli_dbgmsg("ooxml_content_cb: found custom properties file \"%s\" @ %x\n", PN, loff); |
|
531 |
- cust++; |
|
532 |
- //ret = unzip_single_internal(ctx, loff, ooxml_cust_cb); |
|
533 |
- } |
|
525 |
+ /* default: /docProps/custom.xml */ |
|
526 |
+ tmp = unzip_search_single(ctx, (const char *)(PN+1), xmlStrlen(PN)-1, &loff); |
|
527 |
+ if (tmp == CL_ETIMEOUT) { |
|
528 |
+ ret = tmp; |
|
529 |
+ } |
|
530 |
+ else if (tmp != CL_VIRUS) { |
|
531 |
+ cli_dbgmsg("cli_process_ooxml: failed to find custom properties file \"%s\"!\n", PN); |
|
532 |
+ mcust++; |
|
533 |
+ } |
|
534 |
+ else { |
|
535 |
+ cli_dbgmsg("ooxml_content_cb: found custom properties file \"%s\" @ %x\n", PN, loff); |
|
536 |
+ /* custom properties are not parsed */ |
|
537 |
+ cust++; |
|
534 | 538 |
} |
535 | 539 |
} |
536 | 540 |
else if (!xmlStrcmp(CT, (const xmlChar *)"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml")) { |
537 | 541 |
dsig++; |
538 | 542 |
} |
539 | 543 |
|
540 |
- if (ret != CL_BREAK && ret != CL_SUCCESS) |
|
544 |
+ if (ret != CL_SUCCESS) |
|
541 | 545 |
goto ooxml_content_exit; |
542 | 546 |
} |
543 | 547 |
|
544 | 548 |
ooxml_content_exit: |
545 |
- if (core) |
|
549 |
+ if (core) { |
|
546 | 550 |
cli_jsonint(ctx->wrkproperty, "CorePropertiesFileCount", core); |
551 |
+ if (core > 1) |
|
552 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_MULTIPLE_CORE_PROPFILES"); |
|
553 |
+ } |
|
547 | 554 |
else if (!mcore) |
548 | 555 |
cli_dbgmsg("cli_process_ooxml: file does not contain core properties file\n"); |
549 |
- if (mcore) |
|
550 |
- cli_jsonint(ctx->wrkproperty, "CorePropertiesMissingFileCount", core); |
|
556 |
+ if (mcore) { |
|
557 |
+ cli_jsonint(ctx->wrkproperty, "CorePropertiesMissingFileCount", mcore); |
|
558 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_MISSING_CORE_PROPFILES"); |
|
559 |
+ } |
|
551 | 560 |
|
552 |
- if (extn) |
|
561 |
+ if (extn) { |
|
553 | 562 |
cli_jsonint(ctx->wrkproperty, "ExtendedPropertiesFileCount", extn); |
563 |
+ if (extn > 1) |
|
564 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_MULTIPLE_EXTN_PROPFILES"); |
|
565 |
+ } |
|
554 | 566 |
else if (!mextn) |
555 | 567 |
cli_dbgmsg("cli_process_ooxml: file does not contain extended properties file\n"); |
556 |
- if (mextn) |
|
557 |
- cli_jsonint(ctx->wrkproperty, "ExtendedPropertiesMissingFileCount", extn); |
|
568 |
+ if (mextn) { |
|
569 |
+ cli_jsonint(ctx->wrkproperty, "ExtendedPropertiesMissingFileCount", mextn); |
|
570 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_MISSING_EXTN_PROPFILES"); |
|
571 |
+ } |
|
558 | 572 |
|
559 |
- if (cust) |
|
573 |
+ if (cust) { |
|
560 | 574 |
cli_jsonint(ctx->wrkproperty, "CustomPropertiesFileCount", cust); |
575 |
+ if (cust > 1) |
|
576 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_MULTIPLE_CUSTOM_PROPFILES"); |
|
577 |
+ } |
|
561 | 578 |
else if (!mcust) |
562 | 579 |
cli_dbgmsg("cli_process_ooxml: file does not contain custom properties file\n"); |
563 |
- if (mcust) |
|
564 |
- cli_jsonint(ctx->wrkproperty, "CustomPropertiesMissingFileCount", cust); |
|
580 |
+ if (mcust) { |
|
581 |
+ cli_jsonint(ctx->wrkproperty, "CustomPropertiesMissingFileCount", mcust); |
|
582 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_MISSING_CUST_PROPFILES"); |
|
583 |
+ } |
|
565 | 584 |
|
566 | 585 |
if (dsig) { |
567 | 586 |
cli_jsonint(ctx->wrkproperty, "DigitalSignaturesCount", dsig); |
... | ... |
@@ -620,15 +670,23 @@ int cli_process_ooxml(cli_ctx *ctx) |
620 | 620 |
/* find "[Content Types].xml" */ |
621 | 621 |
tmp = unzip_search_single(ctx, "[Content_Types].xml", 18, &loff); |
622 | 622 |
if (tmp == CL_ETIMEOUT) { |
623 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_TIMEOUT"); |
|
623 | 624 |
return CL_ETIMEOUT; |
624 | 625 |
} |
625 | 626 |
else if (tmp != CL_VIRUS) { |
626 | 627 |
cli_dbgmsg("cli_process_ooxml: failed to find ""[Content_Types].xml""!\n"); |
628 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_NO_CONTENT_TYPES"); |
|
627 | 629 |
return CL_EFORMAT; |
628 | 630 |
} |
629 | 631 |
cli_dbgmsg("cli_process_ooxml: found ""[Content_Types].xml"" @ %x\n", loff); |
630 | 632 |
|
631 |
- return unzip_single_internal(ctx, loff, ooxml_content_cb); |
|
633 |
+ tmp = unzip_single_internal(ctx, loff, ooxml_content_cb); |
|
634 |
+ if (tmp == CL_ETIMEOUT) |
|
635 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_TIMEOUT"); |
|
636 |
+ else if (tmp == CL_EMEM) |
|
637 |
+ ooxml_add_parse_error(ctx->wrkproperty, "OOXML_ERROR_OUTOFMEM"); |
|
638 |
+ |
|
639 |
+ return tmp; |
|
632 | 640 |
#else |
633 | 641 |
UNUSEDPARAM(ctx); |
634 | 642 |
cli_dbgmsg("in cli_processooxml\n"); |