about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-01-14 14:13:39 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-01-14 14:18:17 +0100
commit4291453ec30656c2f59645d8a74cf295ce0253a9 (patch)
tree136f9ba52bb9cfebb9c0ab797661dba3ecaeaba3
parentFix missing prototype declarations (diff)
downloadcgit-pink-4291453ec30656c2f59645d8a74cf295ce0253a9.tar.gz
cgit-pink-4291453ec30656c2f59645d8a74cf295ce0253a9.zip
ui-shared: Avoid new line injection into redirect header
-rw-r--r--ui-shared.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 5b48734..21f581f 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -709,7 +709,9 @@ void cgit_print_http_headers(void)
 void cgit_redirect(const char *url, bool permanent)
 {
 	htmlf("Status: %d %s\n", permanent ? 301 : 302, permanent ? "Moved" : "Found");
-	htmlf("Location: %s\n\n", url);
+	html("Location: ");
+	html_url_path(url);
+	html("\n\n");
 	exit(0);
 }