diff --git a/libclamav/htmlnorm.c b/libclamav/htmlnorm.c index e33e1ce34d..3949bfb469 100644 --- a/libclamav/htmlnorm.c +++ b/libclamav/htmlnorm.c @@ -683,27 +683,11 @@ bool html_insert_form_data(const char * const value, form_data_t *tags) { } void html_form_data_tag_free(form_data_t *tags) { - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); - fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__); -// exit(1); + size_t i; + for (i = 0; i < tags->count; i++){ + CLI_FREE_AND_SET_NULL(tags->tag[i]); + } + CLI_FREE_AND_SET_NULL(tags->tag); } static bool cli_html_normalise(cli_ctx *ctx, int fd, m_area_t *m_area, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf, form_data_t * form_data) diff --git a/libclamav/htmlnorm.h b/libclamav/htmlnorm.h index 3f5b87346d..b66966345c 100644 --- a/libclamav/htmlnorm.h +++ b/libclamav/htmlnorm.h @@ -46,7 +46,7 @@ typedef struct m_area_tag { } m_area_t; typedef struct form_data_tag { - unsigned char ** tag; + char ** tag; size_t count; } form_data_t; diff --git a/libclamav/scanners.c b/libclamav/scanners.c index 22d8c1475b..f035261970 100644 --- a/libclamav/scanners.c +++ b/libclamav/scanners.c @@ -2494,7 +2494,6 @@ static bool is_url(const char *const str) static void save_urls(cli_ctx *ctx, tag_arguments_t *hrefs, form_data_t * form_data) { int i = 0; - bool bAdded = false; json_object *ary = NULL; if (NULL == hrefs) { @@ -2524,7 +2523,7 @@ static void save_urls(cli_ctx *ctx, tag_arguments_t *hrefs, form_data_t * form_d } /*Add form_data*/ - for (i = 0; i < form_data->count; i++) { + for (i = 0; i < (int) form_data->count; i++) { if (is_url((const char *)form_data->tag[i])) { if (NULL == ary){ ary = cli_jsonarray(ctx->wrkproperty, HTML_URLS_JSON_KEY); @@ -2554,6 +2553,8 @@ static void save_urls(cli_ctx *ctx, tag_arguments_t *hrefs, form_data_t * form_d cli_dbgmsg("[cli_scanhtml] Failed to add \"%s\" entry JSON array\n", HTML_URLS_JSON_KEY); } #endif + + } static cl_error_t cli_scanhtml(cli_ctx *ctx)