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