From d0e7958617d7f7dafe5ca7e8a27cc64405b4461a Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 1 May 2018 13:04:20 +0200 Subject: [PATCH] lease_file_remove(): replace strncpy/strncat by snprintf() --- miniupnpd/upnpredirect.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/miniupnpd/upnpredirect.c b/miniupnpd/upnpredirect.c index 3f85e7e..160d703 100644 --- a/miniupnpd/upnpredirect.c +++ b/miniupnpd/upnpredirect.c @@ -144,8 +144,7 @@ lease_file_remove(unsigned short eport, int proto) return -1; } - strncpy( tmpfilename, lease_file, sizeof(tmpfilename) ); - strncat( tmpfilename, "XXXXXX", sizeof(tmpfilename) - strlen(tmpfilename)); + snprintf( tmpfilename, sizeof(tmpfilename), "%sXXXXXX", lease_file); fd = fopen( lease_file, "r"); if (fd==NULL) {