Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2018 07:26:24 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r332555 - head/stand/common
Message-ID:  <201804160726.w3G7QOoi026329@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Mon Apr 16 07:26:23 2018
New Revision: 332555
URL: https://svnweb.freebsd.org/changeset/base/332555

Log:
  loader: provide values in help_getnext()
  
  With r328289 we attempt to make sure we free the resources allocated in
  help_getnext(), however, it is possible that we get no resources allocated
  and help_getnext() will return early.
  
  Make sure we have pointers set to NULL early in help_getnext().
  
  Reported by:	Andy Fiddaman

Modified:
  head/stand/common/commands.c

Modified: head/stand/common/commands.c
==============================================================================
--- head/stand/common/commands.c	Mon Apr 16 04:16:46 2018	(r332554)
+++ head/stand/common/commands.c	Mon Apr 16 07:26:23 2018	(r332555)
@@ -64,7 +64,9 @@ static int
 help_getnext(int fd, char **topic, char **subtopic, char **desc) 
 {
     char	line[81], *cp, *ep;
-    
+
+    /* Make sure we provide sane values. */
+    *topic = *subtopic = *desc = NULL;
     for (;;) {
 	if (fgetstr(line, 80, fd) < 0)
 	    return(0);



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