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:18:01 UTC
svn commit: r546805 -
/myfaces/shared/branches/2_0_6/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Author: manolito
Date: Wed Jun 13 03:18:00 2007
New Revision: 546805
URL: http://svn.apache.org/viewvc?view=rev&rev=546805
Log:
TOMAHAWK-983
TOMAHAWK-1021
Modified:
myfaces/shared/branches/2_0_6/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Modified: myfaces/shared/branches/2_0_6/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/branches/2_0_6/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?view=diff&rev=546805&r1=546804&r2=546805
==============================================================================
--- myfaces/shared/branches/2_0_6/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/shared/branches/2_0_6/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Wed Jun 13 03:18:00 2007
@@ -1090,8 +1090,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)
{
@@ -1099,10 +1099,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");
}
@@ -1538,6 +1549,11 @@
public ScriptContext append(char c)
{
buffer.append(c);
+ return this;
+ }
+
+ public ScriptContext append(int i) {
+ buffer.append(i);
return this;
}