... | ... |
@@ -137,7 +137,7 @@ static inline int ps_fill_local_contact(struct sip_msg *msg, str *contact) |
137 | 137 |
contact->len += 1; |
138 | 138 |
p += 1; |
139 | 139 |
} |
140 |
- strncpy(p, ip.s, ip.len); |
|
140 |
+ memcpy(p, ip.s, ip.len); |
|
141 | 141 |
contact->len += ip.len; |
142 | 142 |
p += ip.len; |
143 | 143 |
if(msg->rcv.bind_address->address.af == AF_INET6) { |
... | ... |
@@ -145,7 +145,7 @@ static inline int ps_fill_local_contact(struct sip_msg *msg, str *contact) |
145 | 145 |
contact->len += 1; |
146 | 146 |
p += 1; |
147 | 147 |
} |
148 |
- if(contact->len > LCONTACT_BUF_SIZE - 21) { |
|
148 |
+ if(contact->len > LCONTACT_BUF_SIZE - 22) { |
|
149 | 149 |
LM_ERR("buffer overflow\n"); |
150 | 150 |
goto error; |
151 | 151 |
} |
... | ... |
@@ -156,8 +156,9 @@ static inline int ps_fill_local_contact(struct sip_msg *msg, str *contact) |
156 | 156 |
} |
157 | 157 |
contact->len += len; |
158 | 158 |
p += len; |
159 |
- strncpy(p, proto, plen); |
|
159 |
+ memcpy(p, proto, plen); |
|
160 | 160 |
contact->len += plen; |
161 |
+ contact->s[contact->len] = '\0'; |
|
161 | 162 |
|
162 | 163 |
return 0; |
163 | 164 |
error: |