[pjsip]
[openwrt/svn-archive/archive.git] / package / pjsip / patches / 100-pjsua_acc__snprintf.patch
1 --- a/pjsip/src/pjsua-lib/pjsua_acc.c
2 +++ b/pjsip/src/pjsua-lib/pjsua_acc.c
3 @@ -430,7 +430,7 @@
4 "<sip:%s%.*s%s:%d%s>",
5 beginquote,
6 (int)t->local_name.host.slen,
7 - t->local_name.host.ptr,
8 + t->local_name.host.slen ? t->local_name.host.ptr : "",
9 endquote,
10 t->local_name.port,
11 transport_param);
12 @@ -1158,18 +1158,18 @@
13 len = pj_ansi_snprintf(tmp, PJSIP_MAX_URL_SIZE,
14 "<sip:%.*s%s%s%.*s%s:%d;transport=%s%.*s>%.*s",
15 (int)acc->user_part.slen,
16 - acc->user_part.ptr,
17 + acc->user_part.slen ? acc->user_part.ptr : "",
18 (acc->user_part.slen? "@" : ""),
19 beginquote,
20 (int)via_addr->slen,
21 - via_addr->ptr,
22 + via_addr->slen ? via_addr->ptr : "",
23 endquote,
24 rport,
25 tp->type_name,
26 (int)acc->cfg.contact_uri_params.slen,
27 - acc->cfg.contact_uri_params.ptr,
28 + acc->cfg.contact_uri_params.slen ? acc->cfg.contact_uri_params.ptr : "",
29 (int)acc->cfg.contact_params.slen,
30 - acc->cfg.contact_params.ptr);
31 + acc->cfg.contact_params.slen ? acc->cfg.contact_params.ptr : "");
32 if (len < 1) {
33 PJ_LOG(1,(THIS_FILE, "URI too long"));
34 pj_pool_release(pool);
35 @@ -2233,22 +2233,22 @@
36 contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE,
37 "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>%.*s",
38 (int)acc->display.slen,
39 - acc->display.ptr,
40 + acc->display.slen ? acc->display.ptr : "",
41 (acc->display.slen?" " : ""),
42 (secure ? PJSUA_SECURE_SCHEME : "sip"),
43 (int)acc->user_part.slen,
44 - acc->user_part.ptr,
45 + acc->user_part.slen ? acc->user_part.ptr : "",
46 (acc->user_part.slen?"@":""),
47 beginquote,
48 (int)local_addr.slen,
49 - local_addr.ptr,
50 + local_addr.slen ? local_addr.ptr : "",
51 endquote,
52 local_port,
53 transport_param,
54 (int)acc->cfg.contact_uri_params.slen,
55 - acc->cfg.contact_uri_params.ptr,
56 + acc->cfg.contact_uri_params.slen ? acc->cfg.contact_uri_params.ptr : "",
57 (int)acc->cfg.contact_params.slen,
58 - acc->cfg.contact_params.ptr);
59 + acc->cfg.contact_params.slen ? acc->cfg.contact_params.ptr : "");
60
61 return PJ_SUCCESS;
62 }
63 @@ -2390,22 +2390,22 @@
64 contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE,
65 "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>%.*s",
66 (int)acc->display.slen,
67 - acc->display.ptr,
68 + acc->display.slen ? acc->display.ptr : "",
69 (acc->display.slen?" " : ""),
70 (secure ? PJSUA_SECURE_SCHEME : "sip"),
71 (int)acc->user_part.slen,
72 - acc->user_part.ptr,
73 + acc->user_part.slen ? acc->user_part.ptr : "",
74 (acc->user_part.slen?"@":""),
75 beginquote,
76 (int)local_addr.slen,
77 - local_addr.ptr,
78 + local_addr.slen ? local_addr.ptr : "",
79 endquote,
80 local_port,
81 transport_param,
82 (int)acc->cfg.contact_uri_params.slen,
83 - acc->cfg.contact_uri_params.ptr,
84 + acc->cfg.contact_uri_params.slen ? acc->cfg.contact_uri_params.ptr : "",
85 (int)acc->cfg.contact_params.slen,
86 - acc->cfg.contact_params.ptr);
87 + acc->cfg.contact_params.slen ? acc->cfg.contact_params.ptr : "");
88
89 return PJ_SUCCESS;
90 }