Module: kamailio
Branch: master
Commit: 29686758e1ce51abb8d8dd5bebb0d7fa1a019dc6
URL:
https://github.com/kamailio/kamailio/commit/29686758e1ce51abb8d8dd5bebb0d7f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-09-04T12:43:59+02:00
auth_xkey: use memcpy() instead of strncpy()
---
Modified: src/modules/auth_xkeys/auth_xkeys.c
---
Diff:
https://github.com/kamailio/kamailio/commit/29686758e1ce51abb8d8dd5bebb0d7f…
Patch:
https://github.com/kamailio/kamailio/commit/29686758e1ce51abb8d8dd5bebb0d7f…
---
diff --git a/src/modules/auth_xkeys/auth_xkeys.c b/src/modules/auth_xkeys/auth_xkeys.c
index 9f63ed7b993..a89faa4ce31 100644
--- a/src/modules/auth_xkeys/auth_xkeys.c
+++ b/src/modules/auth_xkeys/auth_xkeys.c
@@ -250,10 +250,10 @@ int auth_xkeys_add(sip_msg_t *msg, str *hdr, str *key, str *alg, str
*data)
return -1;
}
- strncpy(xdata.s, hdr->s, hdr->len);
+ memcpy(xdata.s, hdr->s, hdr->len);
xdata.s[hdr->len] = ':';
xdata.s[hdr->len + 1] = ' ';
- strncpy(xdata.s + hdr->len + 2, xout, xdata.len);
+ memcpy(xdata.s + hdr->len + 2, xout, xdata.len);
xdata.len += hdr->len + 2;
xdata.s[xdata.len] = '\r';
xdata.s[xdata.len + 1] = '\n';