svn commit: r259219 - head/usr.bin/calendar

Eitan Adler eadler at FreeBSD.org
Wed Dec 11 14:54:59 UTC 2013


Author: eadler
Date: Wed Dec 11 14:54:58 2013
New Revision: 259219
URL: http://svnweb.freebsd.org/changeset/base/259219

Log:
  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.

Modified:
  head/usr.bin/calendar/calcpp.c

Modified: head/usr.bin/calendar/calcpp.c
==============================================================================
--- head/usr.bin/calendar/calcpp.c	Wed Dec 11 13:20:32 2013	(r259218)
+++ head/usr.bin/calendar/calcpp.c	Wed Dec 11 14:54:58 2013	(r259219)
@@ -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;


More information about the svn-src-all mailing list