You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Dimuthu Gamage (JIRA)" <ji...@apache.org> on 2007/11/26 12:15:43 UTC
[jira] Commented: (AXIS2C-770) Incorrect memory is allocated for
attributes
[ https://issues.apache.org/jira/browse/AXIS2C-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545409 ]
Dimuthu Gamage commented on AXIS2C-770:
---------------------------------------
Oops, I have miss-calculated again, adding axutil_strlen("<xsl:value-of select="$propertyName"/>")
text_value = axutil_date_time_serialize_date_time(<xsl:value-of select="$propertyInstanceName"/>, env);
string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) *
(5 + ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT +
axutil_strlen(text_value) +
axutil_strlen("<xsl:value-of select="$propertyName"/>")));
sprintf(string_to_stream, " %s%s%s=\"%s\"", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":"",
"<xsl:value-of select="$propertyName"/>", text_value);
axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream));
AXIS2_FREE(env-> allocator, string_to_stream);
Here 5 is for ":=\"\""
ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT for the prefix,
axutil_strlen("<xsl:value-of select="$propertyName"/>") for the "<xsl:value-of select="$propertyName"/>"
axutil_strlen(text_value) for text_value
so the maximum length string would be
prefix:<xsl:value-of select="$propertyName"/>=\"text_value\"
Thanks
> Incorrect memory is allocated for attributes
> --------------------------------------------
>
> Key: AXIS2C-770
> URL: https://issues.apache.org/jira/browse/AXIS2C-770
> Project: Axis2-C
> Issue Type: Bug
> Components: code generation
> Affects Versions: Current (Nightly)
> Reporter: Michael Mole
>
> I noticed in CADBBeanTemplateSource.xsl that some of the attributes have incorrect use of parenthesis which leads to incorrect memory allocation.
> For example (Note this code was taken somewhere in the range of line 2509):
> If you look at lines 4 and 5, we are trying to add 3 numbers: 64, and the values returned from each strlen. The 1st strlen does not close off it's parenthesis before trying to add the value returned by the 2nd strlen.
> 1 <xsl:when test="$nativePropertyType='axutil_base64_binary_t*'">
> 2 text_value = axutil_base64_binary_get_encoded_binary(<xsl:value-of select="$propertyInstanceName"/>, env);
> 3 string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) *
> 4 (64 + strlen("<xsl:value-of select="$propertyName"/>" +
> 5 strlen(text_value))));
> 6 sprintf(string_to_stream, " <xsl:value-of select="$namespacePrefix"/><xsl:value-of select="$propertyName"/>=\"%s\"", text_value);
> 7 axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream));
> 8 AXIS2_FREE(env-> allocator, string_to_stream);
> Lines 4 and 5 should look something more like this:
> I've added a ) right before the + on line 4 and removed a ) right before the ; on line 5.
> 4 (64 + strlen("<xsl:value-of select="$propertyName"/>") +
> 5 strlen(text_value)));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org