Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Jul 9, 2024
1 parent 17b5286 commit ec18f42
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
39 changes: 23 additions & 16 deletions libclamav/htmlnorm.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,16 @@ static void js_process(struct parser_state *js_state, const unsigned char *js_be
}


bool html_insert_form_data(const char * const value, form_data_t *tags) {
bool bRet = false;

//here;

bRet = true;
done:
return bRet;
}

void html_form_data_tag_free(form_data_t *tags) {
fprintf(stderr, "%s::%d::UNIMPLEMENTED!!!\n", __FUNCTION__, __LINE__);
exit(1);
Expand Down Expand Up @@ -1349,8 +1359,8 @@ fprintf(stderr, "%s::%d::SAVE VALUE HERE for FORM TAGS!!!!!\n", __FUNCTION__, __
fprintf(stderr, "%s::%d::%s\n", __FUNCTION__, __LINE__, in_form_action);
if (form_data){
fprintf(stderr, "%s::%d::ADD THE STUFF HERE\n", __FUNCTION__, __LINE__);
html_insert_form_data(in_form_action, form_data);
}
exit(1);
}
} else if (strcmp(tag, "img") == 0) {
arg_value = html_tag_arg_value(&tag_args, "src");
Expand Down Expand Up @@ -2004,6 +2014,11 @@ exit(1);
}

bool html_normalise_mem(cli_ctx *ctx, unsigned char *in_buff, off_t in_size, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf)
{
return html_normalise_mem_form_data(ctx, in_buff, in_size, dirname, hrefs, dconf, NULL);
}

bool html_normalise_mem_form_data(cli_ctx *ctx, unsigned char *in_buff, off_t in_size, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf, form_data_t * form_data)
{
m_area_t m_area;

Expand All @@ -2012,31 +2027,23 @@ bool html_normalise_mem(cli_ctx *ctx, unsigned char *in_buff, off_t in_size, con
m_area.offset = 0;
m_area.map = NULL;

#if 0
return cli_html_normalise(ctx, -1, &m_area, dirname, hrefs, dconf);
#else
fprintf(stderr, "%s::%d::update args\n", __FUNCTION__, __LINE__);
exit(11);
return cli_html_normalise(ctx, -1, &m_area, dirname, hrefs, dconf, NULL);
#endif

return cli_html_normalise(ctx, -1, &m_area, dirname, hrefs, dconf, form_data);
}

bool html_normalise_map(cli_ctx *ctx, fmap_t *map, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf)
{
return html_normalise_map_form_data(ctx, map, dirname, hrefs, dconf, NULL);
}

bool html_normalise_map_form_data(cli_ctx *ctx, fmap_t *map, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf, form_data_t * form_data)
{
bool retval = false;
m_area_t m_area;

m_area.length = map->len;
m_area.offset = 0;
m_area.map = map;
#if 0
retval = cli_html_normalise(ctx, -1, &m_area, dirname, hrefs, dconf);
#else
fprintf(stderr, "%s::%d::update args\n", __FUNCTION__, __LINE__);
exit(11);
retval = cli_html_normalise(ctx, -1, &m_area, dirname, hrefs, dconf, NULL);
#endif
retval = cli_html_normalise(ctx, -1, &m_area, dirname, hrefs, dconf, form_data);
return retval;
}

Expand Down
2 changes: 2 additions & 0 deletions libclamav/htmlnorm.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ typedef struct form_data_tag {
} form_data_t;

bool html_normalise_mem(cli_ctx *ctx, unsigned char *in_buff, off_t in_size, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf);
bool html_normalise_mem_form_data(cli_ctx *ctx, unsigned char *in_buff, off_t in_size, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf, form_data_t * form_data);
bool html_normalise_map(cli_ctx *ctx, fmap_t *map, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf);
bool html_normalise_map_form_data(cli_ctx *ctx, fmap_t *map, const char *dirname, tag_arguments_t *hrefs, const struct cli_dconf *dconf, form_data_t * form_data);
void html_tag_arg_free(tag_arguments_t *tags);
bool html_screnc_decode(fmap_t *map, const char *dirname);
void html_tag_arg_add(tag_arguments_t *tags, const char *tag, char *value);
Expand Down
6 changes: 5 additions & 1 deletion libclamav/scanners.c
Original file line number Diff line number Diff line change
Expand Up @@ -2565,8 +2565,12 @@ static cl_error_t cli_scanhtml(cli_ctx *ctx)
if (STORE_HTML_URLS && SCAN_COLLECT_METADATA && (ctx->wrkproperty != NULL)) {
tag_arguments_t hrefs = {0};
hrefs.scanContents = 1;
(void)html_normalise_map(ctx, map, tempname, &hrefs, ctx->dconf);
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);

} else {
(void)html_normalise_map(ctx, map, tempname, NULL, ctx->dconf);
}
Expand Down

0 comments on commit ec18f42

Please sign in to comment.