svn commit: r334270 - head/usr.bin/logger

Eric van Gyzen vangyzen at FreeBSD.org
Mon May 28 02:40:07 UTC 2018


Author: vangyzen
Date: Mon May 28 02:40:06 2018
New Revision: 334270
URL: https://svnweb.freebsd.org/changeset/base/334270

Log:
  logger: fix memory leak and use-after-free
  
  This one call to getaddrinfo() did not adhere to the common idiom
  of storing the result into a second res0 variable, which is later freed.
  
  Reported by:	Coverity
  CID:		1368069 1368071
  Sponsored by:	Dell EMC

Modified:
  head/usr.bin/logger/logger.c

Modified: head/usr.bin/logger/logger.c
==============================================================================
--- head/usr.bin/logger/logger.c	Mon May 28 02:34:38 2018	(r334269)
+++ head/usr.bin/logger/logger.c	Mon May 28 02:40:06 2018	(r334270)
@@ -298,7 +298,7 @@ socksetup(const char *src, const char *dst, const char
 	error = getaddrinfo(dst, svcname, &hints, &res0);
 	if (error == EAI_SERVICE) {
 		warnx("%s/udp: unknown service", svcname);
-		error = getaddrinfo(dst, "514", &hints, &res);
+		error = getaddrinfo(dst, "514", &hints, &res0);
 	}	
 	if (error)
 		errx(1, "%s: %s", gai_strerror(error), dst);


More information about the svn-src-all mailing list