Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2016 06:02:44 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r300265 - stable/10/usr.bin/mklocale
Message-ID:  <201605200602.u4K62ibt074667@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Fri May 20 06:02:44 2016
New Revision: 300265
URL: https://svnweb.freebsd.org/changeset/base/300265

Log:
  MFC r299524
  
    Use strlcpy() instead of strncpy() when copying the encoding value
    to ensure that the destination is NUL terminated.  Length truncation
    of one more character should not be an issue since encoding values
    that long are not supported by libc.  The destination string is
    treated as a NUL terminated string, but it is only passed to strcmp()
    for comparison to a set of shorter, fixed length strings, so this
    is not a serious problem.
  
  Reported by:	Coverity
  CID:		974769

Modified:
  stable/10/usr.bin/mklocale/yacc.y
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/mklocale/yacc.y
==============================================================================
--- stable/10/usr.bin/mklocale/yacc.y	Fri May 20 05:33:26 2016	(r300264)
+++ stable/10/usr.bin/mklocale/yacc.y	Fri May 20 06:02:44 2016	(r300265)
@@ -123,7 +123,7 @@ entry	:	ENCODING STRING
 		      strcmp($2, "BIG5") &&
 		      strcmp($2, "MSKanji"))
 			warnx("ENCODING %s is not supported by libc", $2);
-		strncpy(new_locale.encoding, $2,
+		strlcpy(new_locale.encoding, $2,
 		    sizeof(new_locale.encoding)); }
 	|	VARIABLE
 		{ new_locale.variable_len = strlen($1) + 1;



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