[sr-dev] git:5.6:ca1e61ec: core: use memcpy and set end of string
Daniel-Constantin Mierla
miconda at gmail.com
Tue Aug 16 12:01:23 CEST 2022
Module: kamailio
Branch: 5.6
Commit: ca1e61ec0453b9a4797ac7af88ac179d27e53685
URL: https://github.com/kamailio/kamailio/commit/ca1e61ec0453b9a4797ac7af88ac179d27e53685
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-08-16T11:54:38+02:00
core: use memcpy and set end of string
(cherry picked from commit 5cd4e817a24308b82fc3f631fb18f354dadf2b7e)
---
Modified: src/core/socket_info.c
---
Diff: https://github.com/kamailio/kamailio/commit/ca1e61ec0453b9a4797ac7af88ac179d27e53685.diff
Patch: https://github.com/kamailio/kamailio/commit/ca1e61ec0453b9a4797ac7af88ac179d27e53685.patch
---
diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index c9dd89118d8..e3ae29bc147 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1502,7 +1502,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