Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Aug 2010 21:59:56 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r211407 - head/sbin/hastd
Message-ID:  <201008162159.o7GLxuhh011013@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Mon Aug 16 21:59:56 2010
New Revision: 211407
URL: http://svn.freebsd.org/changeset/base/211407

Log:
  The 'size' variable is there to limit how many bytes we want to copy from
  'addr'. It is very likely that size of 'addr' is larger than 'size', so checking
  strlcpy() return value is bogus.
  
  MFC after:	3 weeks

Modified:
  head/sbin/hastd/proto_tcp4.c

Modified: head/sbin/hastd/proto_tcp4.c
==============================================================================
--- head/sbin/hastd/proto_tcp4.c	Mon Aug 16 21:26:47 2010	(r211406)
+++ head/sbin/hastd/proto_tcp4.c	Mon Aug 16 21:59:56 2010	(r211407)
@@ -156,8 +156,7 @@ tcp4_addr(const char *addr, struct socka
 		size = (size_t)(pp - addr + 1);
 		if (size > sizeof(iporhost))
 			return (ENAMETOOLONG);
-		if (strlcpy(iporhost, addr, size) >= size)
-			return (ENAMETOOLONG);
+		(void)strlcpy(iporhost, addr, size);
 	}
 	/* Convert string (IP address or host name) to in_addr_t. */
 	ip = str2ip(iporhost);



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