Skip to content

Commit 2324b79

Browse files
marcellanzWhaileee
authored andcommitted
[inets/3392] via code-review; canonicalize the HTTP variable name as uppercase and skip any occurrence of PROXY.
1 parent bbad317 commit 2324b79

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/inets/src/http_server/httpd_script_env.erl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,16 @@ create_http_header_elements(ScriptType, [{Name, Value} | Headers], Acc, OtherAcc
142142
[{Name, Value} | OtherAcc])
143143
end.
144144

145-
http_env_element(cgi, "proxy", _Value) ->
146-
%% CVE-2016-1000107 – https://github.com/erlang/otp/issues/3392
147-
skipped;
148-
http_env_element(cgi, "PROXY", _Value) ->
149-
skipped;
150-
http_env_element(cgi, VarName0, Value) ->
151-
VarName = re:replace(VarName0,"-","_", [{return,list}, global]),
152-
{"HTTP_"++ http_util:to_upper(VarName), Value};
145+
http_env_element(cgi, VarName0, Value) ->
146+
case http_util:to_upper(VarName0) of
147+
"PROXY" ->
148+
%% CVE-2016-1000107 – https://github.com/erlang/otp/issues/3392
149+
skipped;
150+
VarName1 ->
151+
VarNameUpper = re:replace(VarName1, "-", "_", [{return, list}, global]),
152+
{"HTTP_" ++ VarNameUpper, Value}
153+
end;
154+
153155
http_env_element(esi, VarName0, Value) ->
154156
list_to_existing_atom(VarName0),
155157
VarName = re:replace(VarName0,"-","_", [{return,list}, global]),

0 commit comments

Comments
 (0)