[sr-dev] git:master:5cd4e817: core: use memcpy and set end of string

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 8 11:15:07 CEST 2022


Module: kamailio
Branch: master
Commit: 5cd4e817a24308b82fc3f631fb18f354dadf2b7e
URL: https://github.com/kamailio/kamailio/commit/5cd4e817a24308b82fc3f631fb18f354dadf2b7e

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-07-08T11:14:27+02:00

core: use memcpy and set end of string

---

Modified: src/core/socket_info.c

---

Diff:  https://github.com/kamailio/kamailio/commit/5cd4e817a24308b82fc3f631fb18f354dadf2b7e.diff
Patch: https://github.com/kamailio/kamailio/commit/5cd4e817a24308b82fc3f631fb18f354dadf2b7e.patch

---

diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 8c91e873fe..354cbc75b6 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1551,7 +1551,8 @@ static int build_iface_list(void)
 			}
 
 			if(strlen(ifaces[index].name)==0 && strlen(name)>0) {
-				strncpy(ifaces[index].name, name, MAX_IF_LEN-1);
+				memcpy(ifaces[index].name, name, MAX_IF_LEN-1);
+				ifaces[index].name[MAX_IF_LEN-1] = '\0';
 			}
 
 			ifaces[index].index = index;




More information about the sr-dev mailing list