svn commit: r211407 - head/sbin/hastd

Pawel Jakub Dawidek pjd at FreeBSD.org
Mon Aug 16 21:59:56 UTC 2010


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);


More information about the svn-src-head mailing list