Runtime error -- Is it a defect?

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

 



Hi guys,

When I am using pjsip, I encounter the following problems:

I coded a simple test application using the default config for ua, media,
log and register with a sip server.
But it got runtime error when OPTIONS message received from the server.

Root cause:
Here is the error happened.

*in SDP.c*

PJ_DEF(pj_status_t) pjmedia_sdp_rtpmap_to_attr(pj_pool_t *pool,
                                             const pjmedia_sdp_rtpmap
*rtpmap,
                                             pjmedia_sdp_attr **p_attr)
{
  pjmedia_sdp_attr *attr;
  char tempbuf[128];
  int len;

  /* Check arguments. */
  PJ_ASSERT_RETURN(pool && rtpmap && p_attr, PJ_EINVAL);

  /* Check that mandatory attributes are specified. */
  PJ_ASSERT_RETURN(rtpmap->enc_name.slen && rtpmap->clock_rate,
                   PJMEDIA_SDP_EINRTPMAP);


  attr = PJ_POOL_ALLOC_T(pool, pjmedia_sdp_attr);
  PJ_ASSERT_RETURN(attr != NULL, PJ_ENOMEM);

  attr->name.ptr = "rtpmap";
  attr->name.slen = 6;


  /* Format: ":pt enc_name/clock_rate[/param]" */

*          len = pj_ansi_snprintf(tempbuf, sizeof(tempbuf),
                         "%.*s %.*s/%u%s%.*s",
                         (int)rtpmap->pt.slen,
                         rtpmap->pt.ptr,
                         (int)rtpmap->enc_name.slen,
                         rtpmap->enc_name.ptr,
                         rtpmap->clock_rate,
                         (rtpmap->param.slen ? "/" : ""),
                         (int)rtpmap->param.slen,
                         rtpmap->param.ptr);*



  if (len < 1 || len > (int)sizeof(tempbuf))
      return PJMEDIA_SDP_ERTPMAPTOOLONG;

  attr->value.slen = len;
  attr->value.ptr = (char*) pj_pool_alloc(pool, attr->value.slen+1);
  pj_memcpy(attr->value.ptr, tempbuf, attr->value.slen+1);

  *p_attr = attr;
  return PJ_SUCCESS;
}


The bold fonts above got error if *rtpmap->param.slen = 0 and
**rtpmap->param.ptr
can not be read.
My question is where I can set the value of the **rtpmap->param? Is it
must-doing? Or this is a defect that it should check the slen for string and
do not get the string if its len is zero.*

Your reply is highly appreciate!!
-- 
Thanks & Best Regards!

Email:rashaguo at gmail.com <Email%3Arashaguo at gmail.com>
MSN:ra8310abc at hotmail.com <MSN%3Ara8310abc at hotmail.com>
------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~I play every game like the last one!~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090630/eb2a075c/attachment.html>


[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