Use strlcpy in place where strncpy(s, ...) + s[sizeof(s)-1] = \0; was used
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
#include <isc/platform.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <named/globals.h>
|
||||
@@ -438,12 +439,12 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd,
|
||||
*/
|
||||
if (strcmp((char *) &dir->entry.name[6],
|
||||
"-") == 0)
|
||||
strcpy(host, "*");
|
||||
else {
|
||||
strncpy(host,
|
||||
{
|
||||
strlcpy(host, "*", sizeof(host));
|
||||
} else {
|
||||
strlcpy(host,
|
||||
(char *) &dir->entry.name[6],
|
||||
sizeof(host) - 1);
|
||||
host[NAME_MAX-1] = '\0';
|
||||
sizeof(host));
|
||||
}
|
||||
foundHost = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user