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 "Samisa Abeysinghe (JIRA)" <ji...@apache.org> on 2006/10/02 17:10:21 UTC

[jira] Created: (AXIS2C-318) xmlBufferPtr is used incorrectly in libxml2_writer_wrapper

xmlBufferPtr is used incorrectly in libxml2_writer_wrapper
----------------------------------------------------------

                 Key: AXIS2C-318
                 URL: http://issues.apache.org/jira/browse/AXIS2C-318
             Project: Axis2-C
          Issue Type: Bug
          Components: xml/parser
    Affects Versions: Current (Nightly)
            Reporter: Samisa Abeysinghe


in axis2_libxml2_writer_wrapper_get_xml function we have:
output = AXIS2_MALLOC(env->allocator,
                    sizeof(axis2_char_t) * (
                        strlen((const axis2_char_t*)(writer_impl->buffer->content)) + 1));
            sprintf(output,
                    ((const axis2_char_t*)(writer_impl->buffer->content)));

Where buffer is defined as:

xmlBufferPtr buffer;

Looking at the definition of xmlBuffer, it looks to me that there is a size field that we should look into.  Hence, just taking strlen of buffer content is error prone. Also, content is of type 'unsigned char'. Hence casting that to 'axis2_char_t' may also lead to errors.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Assigned: (AXIS2C-318) xmlBufferPtr is used incorrectly in libxml2_writer_wrapper

Posted by "Samisa Abeysinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2C-318?page=all ]

Samisa Abeysinghe reassigned AXIS2C-318:
----------------------------------------

    Assignee: Samisa Abeysinghe

> xmlBufferPtr is used incorrectly in libxml2_writer_wrapper
> ----------------------------------------------------------
>
>                 Key: AXIS2C-318
>                 URL: http://issues.apache.org/jira/browse/AXIS2C-318
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: xml/parser
>    Affects Versions: Current (Nightly)
>            Reporter: Samisa Abeysinghe
>         Assigned To: Samisa Abeysinghe
>
> in axis2_libxml2_writer_wrapper_get_xml function we have:
> output = AXIS2_MALLOC(env->allocator,
>                     sizeof(axis2_char_t) * (
>                         strlen((const axis2_char_t*)(writer_impl->buffer->content)) + 1));
>             sprintf(output,
>                     ((const axis2_char_t*)(writer_impl->buffer->content)));
> Where buffer is defined as:
> xmlBufferPtr buffer;
> Looking at the definition of xmlBuffer, it looks to me that there is a size field that we should look into.  Hence, just taking strlen of buffer content is error prone. Also, content is of type 'unsigned char'. Hence casting that to 'axis2_char_t' may also lead to errors.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Closed: (AXIS2C-318) xmlBufferPtr is used incorrectly in libxml2_writer_wrapper

Posted by "Samisa Abeysinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2C-318?page=all ]

Samisa Abeysinghe closed AXIS2C-318.
------------------------------------

    Fix Version/s: 0.95
       Resolution: Fixed

Fixed using following logic

output = AXIS2_MALLOC(env->allocator,
                    sizeof(axis2_char_t) * (
                        writer_impl->buffer->size + 1));
            memcpy(output, writer_impl->buffer->content, writer_impl->buffer->size);
            output[writer_impl->buffer->size] = '\0';

> xmlBufferPtr is used incorrectly in libxml2_writer_wrapper
> ----------------------------------------------------------
>
>                 Key: AXIS2C-318
>                 URL: http://issues.apache.org/jira/browse/AXIS2C-318
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: xml/parser
>    Affects Versions: Current (Nightly)
>            Reporter: Samisa Abeysinghe
>         Assigned To: Samisa Abeysinghe
>             Fix For: 0.95
>
>
> in axis2_libxml2_writer_wrapper_get_xml function we have:
> output = AXIS2_MALLOC(env->allocator,
>                     sizeof(axis2_char_t) * (
>                         strlen((const axis2_char_t*)(writer_impl->buffer->content)) + 1));
>             sprintf(output,
>                     ((const axis2_char_t*)(writer_impl->buffer->content)));
> Where buffer is defined as:
> xmlBufferPtr buffer;
> Looking at the definition of xmlBuffer, it looks to me that there is a size field that we should look into.  Hence, just taking strlen of buffer content is error prone. Also, content is of type 'unsigned char'. Hence casting that to 'axis2_char_t' may also lead to errors.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org