Hello. I do not think that this is a bug.. If you look at standard function "strcat()" in google you can see that the tmp variable should be enough for storing all the string. http://www.cplusplus.com/reference/clibrary/cstring/strcat/ So: pj_str_t tmp = {"sip:",4}; > > Is Error because the size of the string will only be 4 letters and there is no space for additional string. You should write: pj_str_t tmp={"sip:",pj_strlen(sip_user)+4); Leo. On Thu, Jan 26, 2012 at 7:33 PM, sjs205 <sjs205.linux at gmail.com> wrote: > ** > Thanks for getting back to me again Hari, should I report this as a bug > then? > > On 01/26/2012 03:22 AM, Hari Narayanan wrote: > > There is no need to. pj_strcat need to do that if I understand its > function correctly. > > Hari > > On Wed, Jan 25, 2012 at 7:48 PM, sjs205 <sjs205.linux at gmail.com> wrote: > >> Hello, >> >> Thank you for getting back to me. Should I allocate some space from the >> pool for the two pj_str variables? I assumed that the pjsua library would >> do that for me. >> >> BR >> >> Steven >> >> >> On 01/25/2012 01:48 PM, Hari Narayanan wrote: >> >> Yes, I copied and executed your code. I see seg fault on Windows XP. The >> memcpy corresponding to pj_strcat is trying to copy characters from argv[1] >> to where it is not supposed to. I do not see any memory alloction preceding >> memcpy. >> >> Hari >> >> On Wed, Jan 25, 2012 at 4:44 PM, sjs205 <sjs205.linux at gmail.com> wrote: >> >>> Hello all, >>> >>> It is probably just me being stupid - I am fairly new to C and pjsip so >>> go easy on me - but I'm having some problems with the pj_strcat function. >>> The following file just segfaults, can anyone tell me why?: >>> >>> #include <pjsua.h> >>> int main(int argc, char *argv[]) >>> { >>> const pj_str_t sip_user = pj_str(argv[1]); >>> pj_str_t tmp = {"sip:",4}; >>> >>> pj_strcat(&tmp, &sip_user); >>> >>> printf("STRING: %s ***", tmp); >>> return 0; >>> } >>> >>> BR >>> >>> Steven >>> >>> >>> _______________________________________________ >>> Visit our blog: http://blog.pjsip.org >>> >>> pjsip mailing list >>> pjsip at lists.pjsip.org >>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >>> >> >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip at lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120127/bd05eaa3/attachment-0001.html>