Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2013 14:54:58 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259219 - head/usr.bin/calendar
Message-ID:  <201312111454.rBBEswxF013675@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312111454.rBBEswxF013675>