1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

mod_lua: Prevent HTTP Response Splitting by not allowing tables in the request_rec to be set with values containing newlines. This is a semi-ugly hack, but it will have to do until we find another way of setting these values.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1582262 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Gruno
2014-03-27 11:20:03 +00:00
parent 2514105ae4
commit 8ae663bc78

View File

@@ -39,7 +39,14 @@ static int lua_table_set(lua_State *L)
apr_table_t *t = ap_lua_check_apr_table(L, 1);
const char *key = luaL_checkstring(L, 2);
const char *val = luaL_checkstring(L, 3);
/* Prevent response/header splitting by not allowing newlines in tables.
* At this stage, we don't have the request_rec handy, and we can't change
* a const char*, so we'll redirect to a standard error value instead.
*/
if (ap_strchr_c(val, '\n')) {
val = "[ERROR: Value contains newline, ignored.]";
}
apr_table_set(t, key, val);
return 0;
}