* Prevent response splitting vulnerability reported by

Paul Alexandrow on helma-dev.
This commit is contained in:
hns 2007-11-13 14:23:57 +00:00
parent 54617d09c1
commit 2721d55139

View file

@ -442,8 +442,9 @@ public final class ResponseTrans extends Writer implements Serializable {
* @throws RedirectException ... * @throws RedirectException ...
*/ */
public void redirect(String url) throws RedirectException { public void redirect(String url) throws RedirectException {
redir = url; redir = url == null ?
throw new RedirectException(url); null : url.replaceAll("[\r\n]", "");
throw new RedirectException(redir);
} }
/** /**
@ -463,8 +464,9 @@ public final class ResponseTrans extends Writer implements Serializable {
* @throws RedirectException ... * @throws RedirectException ...
*/ */
public void forward(String url) throws RedirectException { public void forward(String url) throws RedirectException {
forward = url; forward = url == null ?
throw new RedirectException(url); null : url.replaceAll("[\r\n]", "");
throw new RedirectException(forward);
} }
/** /**