You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2007/06/13 12:32:39 UTC
svn commit: r546813 -
/myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Author: manolito
Date: Wed Jun 13 03:32:35 2007
New Revision: 546813
URL: http://svn.apache.org/viewvc?view=rev&rev=546813
Log:
TOMAHAWK-983
TOMAHAWK-1021
(merged from 2.0.6 branch)
Modified:
myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Modified: myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?view=diff&rev=546813&r1=546812&r2=546813
==============================================================================
--- myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Wed Jun 13 03:32:35 2007
@@ -1208,8 +1208,8 @@
String scrolling = (String)externalContext.getRequestParameterMap().get(AUTO_SCROLL_PARAM);
if (scrolling != null && scrolling.length() > 0)
{
- String x = "0";
- String y = "0";
+ int x = 0;
+ int y = 0;
int comma = scrolling.indexOf(',');
if (comma == -1)
{
@@ -1217,10 +1217,21 @@
}
else
{
- x = scrolling.substring(0, comma);
- if (x.equals("undefined")) x = "0";
- y = scrolling.substring(comma + 1);
- if (y.equals("undefined")) y = "0";
+ try {
+ //we convert to int against XSS vulnerability
+ x = Integer.parseInt(scrolling.substring(0, comma));
+ } catch (NumberFormatException e) {
+ log.warn("Error getting x offset for autoscroll feature. Bad param value: " + scrolling);
+ x = 0; //ignore false numbers
+ }
+
+ try {
+ //we convert to int against XSS vulnerability
+ y = Integer.parseInt(scrolling.substring(comma + 1));
+ } catch (NumberFormatException e) {
+ log.warn("Error getting y offset for autoscroll feature. Bad param value: " + scrolling);
+ y = 0; //ignore false numbers
+ }
}
script.append("window.scrollTo(").append(x).append(",").append(y).append(");\n");
}
@@ -1705,6 +1716,11 @@
public ScriptContext append(char c)
{
buffer.append(c);
+ return this;
+ }
+
+ public ScriptContext append(int i) {
+ buffer.append(i);
return this;
}