You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2010/12/05 15:46:32 UTC
svn commit: r1042364 - in /tomcat/jk/trunk: native/common/jk_map.c
xdocs/miscellaneous/changelog.xml
Author: rjung
Date: Sun Dec 5 14:46:32 2010
New Revision: 1042364
URL: http://svn.apache.org/viewvc?rev=1042364&view=rev
Log:
BZ 50339: Fix whitespace trimming when parsing attribute
lists.
strcpy() behaviour is undefined when strings
Modified:
tomcat/jk/trunk/native/common/jk_map.c
tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
Modified: tomcat/jk/trunk/native/common/jk_map.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_map.c?rev=1042364&r1=1042363&r2=1042364&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_map.c (original)
+++ tomcat/jk/trunk/native/common/jk_map.c Sun Dec 5 14:46:32 2010
@@ -629,27 +629,29 @@ static void trim_prp_comment(char *prp)
static size_t trim(char *s)
{
- size_t i;
+ size_t first;
+ size_t len;
/* check for empty strings */
- if (!(i = strlen(s)))
+ if (!(len = strlen(s)))
return 0;
- for (i = i - 1; (i > 0) &&
- isspace((int)((unsigned char)s[i])); i--);
- if ((i > 0) || !isspace((int)((unsigned char)s[i]))) {
- i++;
+ for (len = len - 1; (len > 0) &&
+ isspace((int)((unsigned char)s[len])); len--);
+ if ((len > 0) || !isspace((int)((unsigned char)s[len]))) {
+ len++;
}
- s[i] = '\0';
+ s[len] = '\0';
+ len++;
- for (i = 0; ('\0' != s[i]) &&
- isspace((int)((unsigned char)s[i])); i++);
+ for (first = 0; (s[first] != '\0') &&
+ isspace((int)((unsigned char)s[first])); first++);
- if (i > 0) {
- strcpy(s, &s[i]);
+ if (first > 0) {
+ memmove(s, s + first, len - first);
}
- return strlen(s);
+ return len;
}
static int map_realloc(jk_map_t *m)
Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1042364&r1=1042363&r2=1042364&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Sun Dec 5 14:46:32 2010
@@ -51,7 +51,11 @@
</add>
<fix>
<bug>50363</bug>: IIS: Prevent chunk encoding of empty message
- bodies for 204, 205 and 304 responses. (timw)
+ bodies for 204, 205 and 304 responses. (timw)
+ </fix>
+ <fix>
+ <bug>50339</bug>: Fix whitespace trimming when parsing attribute
+ lists. (rjung)
</fix>
</changelog>
</subsection>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org