Index: res_agi.c =================================================================== --- res_agi.c (revision 54463) +++ res_agi.c (working copy) @@ -1941,6 +1941,34 @@ return RESULT_SUCCESS; } +static void write_html_escaped(FILE *htmlfile, char *str) +{ + char *cur = str; + + while(*cur) { + switch (*cur) { + case '<': + fprintf(htmlfile, "%s", "<"); + break; + case '>': + fprintf(htmlfile, "%s", ">"); + break; + case '&': + fprintf(htmlfile, "%s", "&"); + break; + case '"': + fprintf(htmlfile, "%s", """); + break; + default: + fprintf(htmlfile, "%c", *cur); + break; + } + cur++; + } + + return; +} + static int handle_agidumphtml(int fd, int argc, char *argv[]) { struct agi_command *e; @@ -1974,16 +2002,20 @@ ast_join(fullcmd, sizeof(fullcmd), e->cmda); fprintf(htmlfile, "
%s - %s |
---|
%s - %s |
%s |
"); + write_html_escaped(htmlfile, tempstr); + fprintf(htmlfile, " |
\n");
- while ((tempstr = strsep(&stringp, "\n")) != NULL)
- fprintf(htmlfile, "%s \n",tempstr); + while ((tempstr = strsep(&stringp, "\n")) != NULL) { + write_html_escaped(htmlfile, tempstr); + fprintf(htmlfile, " \n"); + } fprintf(htmlfile, " |