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