File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2252,9 +2252,14 @@ run_http_header() {
22522252 # Quit on first empty line to catch 98% of the cases. Next pattern is there because the SEDs tested
22532253 # so far seem not to be fine with header containing x0d x0a (CRLF) which is the usual case.
22542254 # So we also trigger also on any sign on a single line which is not alphanumeric (plus _)
2255- sed -e '/^$/q' -e '/^[^a-zA-Z_0-9]$/q' $HEADERFILE >$HEADERFILE.tmp
2255+ #
2256+ # Also we use tr here to remove any crtl chars which the server side offers --> possible security problem
2257+ # Only allowed now is LF + CR. See #2337
2258+ # awk, see above, doesn't seem to care
2259+ sed -e '/^$/q' -e '/^[^a-zA-Z_0-9]$/q' $HEADERFILE | tr -d '\000-\011\013\014\016-\037' >$HEADERFILE.tmp
2260+ sed -e '/^$/q' -e '/^[^a-zA-Z_0-9]$/q' $HEADERFILE | tr -d '\000-\010\013\014\016-\037' >$HEADERFILE.tmp
22562261 # Now to be more sure we delete from '<' or '{' maybe with a leading blank until the end
2257- sed -e '/^ *<.*$/d' -e '/^ *{.*$/d' $HEADERFILE.tmp >$HEADERFILE
2262+ sed -e '/^ *<.*$/d' -e '/^ *{.*$/d' $HEADERFILE.tmp >$HEADERFILE
22582263 debugme echo -e "---\n $(< $HEADERFILE) \n---"
22592264
22602265 HTTP_STATUS_CODE=$(awk '/^HTTP\// { print $2 }' $HEADERFILE 2>>$ERRFILE)
You can’t perform that action at this time.
0 commit comments