diff --git a/CGI/man.c b/CGI/man.c index 7e3df56..61bf4ec 100644 --- a/CGI/man.c +++ b/CGI/man.c @@ -63,6 +63,8 @@ bool kn_has_manpage(const char* str) { return true; } +#define HTML(buf) (buf[0] == '<' ? "<" : (buf[0] == '>' ? ">" : (buf[0] == '&' ? "&" : buf))) + char* kn_manpage_process(const char* path) { char* b = malloc(1); b[0] = 0; @@ -107,7 +109,7 @@ char* kn_manpage_process(const char* path) { m = 0; cbuf[0] = s; tmp = b; - b = kn_strcat(b, cbuf); + b = kn_strcat(b, HTML(cbuf)); free(tmp); } else { if(old == s) { @@ -125,7 +127,7 @@ char* kn_manpage_process(const char* path) { } m = 'B'; tmp = b; - b = kn_strcat(b, cbuf); + b = kn_strcat(b, HTML(cbuf)); free(tmp); } else if(old == '_') { cbuf[0] = s; @@ -141,7 +143,7 @@ char* kn_manpage_process(const char* path) { free(tmp); } tmp = b; - b = kn_strcat(b, cbuf); + b = kn_strcat(b, HTML(cbuf)); free(tmp); tmp = b; b = kn_strcat(b, "");