From: Seungah Lim Date: Thu, 17 Dec 2020 02:40:34 +0000 (+0900) Subject: [APR-6542]libstrongswan: fix prevent issue (CID: 330540) X-Git-Tag: MMI-RSA31.Q1-48-36-11~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6924cefc3a18420ebed0ae894f5afb257bfef821;p=GitHub%2FMotorolaMobilityLLC%2Fexternal-strongswan.git [APR-6542]libstrongswan: fix prevent issue (CID: 330540) [Issue] S5E9815-5808 [Problem] CID 330540 Buffer not null terminated. [Cause] buffer size warning : Calling strncpy with a maximun size argument of 16 bytes on destination array this->if_name of size might leave the destination string unterminated. [Solution] fix prevent issue by updating strncpy. Change-Id: I0735a44c82672d4903dc833676cc4bc02bb3f91a Signed-off-by: Seungah Lim --- diff --git a/src/libstrongswan/networking/tun_device.c b/src/libstrongswan/networking/tun_device.c index 676d69a..3162733 100755 --- a/src/libstrongswan/networking/tun_device.c +++ b/src/libstrongswan/networking/tun_device.c @@ -653,7 +653,7 @@ tun_device_t *xfrm_device_create(const char *name) .tunfd = -1, .sock = -1, ); - strncpy(this->if_name, name, IFNAMSIZ); + strncpy(this->if_name, name, IFNAMSIZ - 1); this->addresses = linked_list_create(); this->is_xfrm_device = TRUE;