xml_print_node has some problem in processing empy attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think xml_print_node has some problem in processing empy attribute, e.g.  <x attributeA= “” …  /x>, here attributeA has an empty value


So in code 


/* Attribute name. */

pj_memcpy(p, attr->name.ptr, attr->name.slen);

p += attr->name.slen;


/* Attribute value. */

if (attr->value.slen) {

    *p++ = '=';

    *p++ = '"';

    pj_memcpy(p, attr->value.ptr, attr->value.slen);

    p += attr->value.slen;

    *p++ = '"';

}


if attr->value.slen == 0, i.e. empty attribute value, then it will print as <x attributeA … > this then become an invalid xml string!

I think the check if (attr->value.slen) is unnecessary because if it is 0, pj_memcpy(p, attr->value.ptr, attr->value.slen); is no-op  so no harm here. But the result will become valid now, i.e. <x attributeA =“" … >



_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux