#86 2 xp_parser.c issues

v3.4
closed-fixed
Rob Day
None
5
2013-04-27
2007-10-11
David W. Burhans
No

I've identified two bugs the xp_parser.c file and one optimization suggestion.

Bugs:
xp_set_xml_buffer_from_file() will leave the file open when index >= XP_MAX_FILE_LEN within the while loop.

xp_set_xml_buffer_from_string() strlen() should return a negative value if the parameter "str" is null.

Optimization Suggestion:
xp_get_content_length() may be optimized by nesting the consecutive if statements (for content-length).
Ex.
L_ctl_hdr = strstr(P_buffer, "\nContent-Length:");
if (!L_ctl_hdr)
{
L_ctl_hdr = strstr(P_buffer, "\nContent-length:");

  if \(\!L\_ctl\_hdr\)
  \{
    L\_ctl\_hdr = strstr\(P\_buffer, "\ncontent-Length:"\);

...

Discussion

  • Logged In: YES
    user_id=1475960
    Originator: NO

    Hello David,

    Thank you for reporting this. Which sipp version did you use ?
    The XML parsing has other problems and will be reviewed after the 3.0 version delivery. We'll review your patch then.

    Thanks and regards,

    Olivier Boulkroune

     
  • Logged In: YES
    user_id=1475960
    Originator: NO

    To be reviewed

     
  • Rob Day
    Rob Day
    2012-12-15

    • assigned_to: Rob Day
    • milestone: --> v3.4
     
  • Rob Day
    Rob Day
    2013-04-27

    The xp_set_xml_buffer_from_file() bug is already fixed; I'm afraid I'm not quite sure what you mean about the strlen() issue in xp_set_xml_buffer_from_string().

    As to your optimisation suggestion, I suspect that the speed gain from this sort of micro-optimisation would be very small - and since this sort of nesting of conditionals makes the code a little harder to read, I'd prefer not to do it.

    Thanks for contributing!

     
  • Rob Day
    Rob Day
    2013-04-27

    • status: open --> closed-fixed