Quote HTML entities in s_server output
authorRich Salz <rsalz@openssl.org>
Sat, 25 Apr 2015 20:06:19 +0000 (16:06 -0400)
committerRich Salz <rsalz@openssl.org>
Sat, 25 Apr 2015 20:06:19 +0000 (16:06 -0400)
Reviewed-by: Richard Levitte <levitte@openssl.org>
apps/s_server.c

index 3644381ece1d3a4404dc4cda2b2ad78aa0c3d99e..88309a6b9c78d324594ec56a31d40e2b14deafee 100644 (file)
@@ -2723,7 +2723,22 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
 /*                      BIO_puts(io,SSLeay_version(SSLEAY_VERSION));*/
             BIO_puts(io, "\n");
             for (i = 0; i < local_argc; i++) {
-                BIO_puts(io, local_argv[i]);
+                const char *myp;
+                for (myp = local_argv[i]; *myp; myp++)
+                    switch (*myp) {
+                    case '<':
+                        BIO_puts(io, "&lt;");
+                        break;
+                    case '>':
+                        BIO_puts(io, "&gt;");
+                        break;
+                    case '&':
+                        BIO_puts(io, "&amp;");
+                        break;
+                    default:
+                        BIO_write(io, myp, 1);
+                        break;
+                    }
                 BIO_write(io, " ", 1);
             }
             BIO_puts(io, "\n");