calendar(1): use strlcpy instead of strncpy

use strlcpy instead of strncpy which avoids non-null-termination if the string is MAXPATHLEN bytes or longer.
This commit is contained in:
Eitan Adler 2013-12-11 14:54:58 +00:00
parent e892b3fe36
commit 6e8706afba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259219

View File

@ -133,7 +133,7 @@ tokenscpp(char *buf, char *string)
s = p;
while(!isspace((unsigned char)*p))
p++;
strncpy(string, s, MAXPATHLEN);
strlcpy(string, s, MAXPATHLEN);
return(T_DEFINE);
} else if ((p = strstr(buf, "#ifndef")) != NULL) {
p += 8;