diff --git a/libclamav/htmlnorm.c b/libclamav/htmlnorm.c
index 10c3aa34a7..e33e1ce34d 100644
--- a/libclamav/htmlnorm.c
+++ b/libclamav/htmlnorm.c
@@ -684,7 +684,26 @@ 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__);
- exit(1);
+ 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);
}
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/scanners.c b/libclamav/scanners.c
index 4a3ba5684c..22d8c1475b 100644
--- a/libclamav/scanners.c
+++ b/libclamav/scanners.c
@@ -2491,10 +2491,12 @@ static bool is_url(const char *const str)
return bRet;
#undef MATCH
}
-static void save_urls(cli_ctx *ctx, tag_arguments_t *hrefs)
+static void save_urls(cli_ctx *ctx, tag_arguments_t *hrefs, form_data_t * form_data)
{
int i = 0;
- bool haveOne = false;
+ bool bAdded = false;
+ json_object *ary = NULL;
+
if (NULL == hrefs) {
return;
}
@@ -2507,14 +2509,37 @@ static void save_urls(cli_ctx *ctx, tag_arguments_t *hrefs)
return;
}
+ /*Add hrefs*/
for (i = 0; i < hrefs->count; i++) {
if (is_url((const char *)hrefs->value[i])) {
- haveOne = true;
- break;
+ if (NULL == ary){
+ ary = cli_jsonarray(ctx->wrkproperty, HTML_URLS_JSON_KEY);
+ if (!ary){
+ cli_dbgmsg("[cli_scanhtml] Failed to add \"%s\" entry JSON array\n", HTML_URLS_JSON_KEY);
+ return;
+ }
+ }
+ cli_jsonstr(ary, NULL, (const char *)hrefs->value[i]);
}
}
- if (!haveOne) {
+ /*Add form_data*/
+ for (i = 0; i < 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);
+ if (!ary){
+ cli_dbgmsg("[cli_scanhtml] Failed to add \"%s\" entry JSON array\n", HTML_URLS_JSON_KEY);
+ return;
+ }
+ }
+ cli_jsonstr(ary, NULL, (const char *)form_data->tag[i]);
+ }
+ }
+
+
+#if 0
+ if (!bAdded) {
return;
}
@@ -2528,6 +2553,7 @@ static void save_urls(cli_ctx *ctx, tag_arguments_t *hrefs)
} else {
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)
@@ -2567,10 +2593,7 @@ static cl_error_t cli_scanhtml(cli_ctx *ctx)
hrefs.scanContents = 1;
form_data_t form_data = {0};
(void)html_normalise_map_form_data(ctx, map, tempname, &hrefs, ctx->dconf, &form_data);
- save_urls(ctx, &hrefs);
-
-fprintf(stderr, "%s::%d::SAVE THE FORM DATA TAGS HERE, TOOO!!!\n", __FUNCTION__, __LINE__); exit(11);
-
+ save_urls(ctx, &hrefs, &form_data);
html_form_data_tag_free(&form_data);
} else {
(void)html_normalise_map(ctx, map, tempname, NULL, ctx->dconf);