|
@@ -202,6 +202,7 @@ int auth_xkeys_add(sip_msg_t* msg, str *hdr, str *key,
|
|
auth_xkey_t *itc;
|
|
auth_xkey_t *itc;
|
|
char xout[SHA512_DIGEST_STRING_LENGTH];
|
|
char xout[SHA512_DIGEST_STRING_LENGTH];
|
|
struct lump* anchor;
|
|
struct lump* anchor;
|
|
|
|
+ char *p;
|
|
|
|
|
|
if(_auth_xkeys_list==NULL || *_auth_xkeys_list==NULL) {
|
|
if(_auth_xkeys_list==NULL || *_auth_xkeys_list==NULL) {
|
|
LM_ERR("no stored keys\n");
|
|
LM_ERR("no stored keys\n");
|
|
@@ -266,8 +267,16 @@ int auth_xkeys_add(sip_msg_t* msg, str *hdr, str *key,
|
|
LM_ERR("can't get anchor\n");
|
|
LM_ERR("can't get anchor\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
- if (insert_new_lump_before(anchor, xdata.s, xdata.len, 0) == 0) {
|
|
|
|
|
|
+ p = (char*)pkg_malloc(xdata.len+1);
|
|
|
|
+ if(p==NULL) {
|
|
|
|
+ LM_ERR("no more pkg memory\n");
|
|
|
|
+ return -2;
|
|
|
|
+ }
|
|
|
|
+ memcpy(p, xdata.s, xdata.len);
|
|
|
|
+ p[xdata.len] = '\0';
|
|
|
|
+ if (insert_new_lump_before(anchor, p, xdata.len, 0) == 0) {
|
|
LM_ERR("cannot insert the new header [%.*s]\n", hdr->len, hdr->s);
|
|
LM_ERR("cannot insert the new header [%.*s]\n", hdr->len, hdr->s);
|
|
|
|
+ pkg_free(p);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|