Bug in pjsip_contact_hdr_print()

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

 



Hi,

I am using pjsip 1.8.10 so I am not sure if this has already been taken care 
of.

I have seen that while sending out REGISTERs with contacts having 'q' value 
with '0' after the decimal point (e.g. 0.005) are not being properly printed 
out onto the packet sent out. Zeros after the decimal point are being 
trimmed out. Here's the problematic piece of code from function 
pjsip_contact_hdr_print() in sip_msg.c -

pj_memcpy(buf, ";q=", 3);
printed = pj_utoa(hdr->q1000/1000, buf+3);
buf += printed + 3;
frac = hdr->q1000 % 1000;

if (frac != 0) {
*buf++ = '.';
if ((frac % 100)==0) frac /= 100;
if ((frac/100) == 0) *buf++ = '0'; //Added by me
if ((frac % 10)==0) frac /= 10;
if ((frac/10) == 0) *buf++ = '0'; //Added by me
printed = pj_utoa(frac, buf);
buf += printed;
}

The fix is also quite simple. Please do revert if yout think this breaks 
anything.

Regards,
Anshuman




[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