diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index fb13878382..7bcdd44991 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -730,6 +730,26 @@ static char* heap_printf(const char *format, ...) return ret; } +static void write_xml_text(FILE *file, const char *text) +{ + int i; + for (i = 0; text[i]; i++) + { + if (text[i] == '&') + fputs("&", file); + else if (text[i] == '<') + fputs("<", file); + else if (text[i] == '>') + fputs(">", file); + else if (text[i] == '\'') + fputs("'", file); + else if (text[i] == '"') + fputs(""", file); + else + fputc(text[i], file); + } +} + static BOOL create_directories(char *directory) { BOOL ret = TRUE; @@ -1805,10 +1825,18 @@ static BOOL write_freedesktop_mime_type_entry(const char *packages_dir, const ch { fprintf(packageFile, "\n"); fprintf(packageFile, "\n"); - fprintf(packageFile, " \n", mime_type); - fprintf(packageFile, " \n", dot_extension); + fprintf(packageFile, " \n"); + fprintf(packageFile, " \n"); if (comment) - fprintf(packageFile, " %s\n", comment); + { + fprintf(packageFile, " "); + write_xml_text(packageFile, comment); + fprintf(packageFile, "\n"); + } fprintf(packageFile, " \n"); fprintf(packageFile, "\n"); ret = TRUE;