svn commit: r357132 - stable/12/sbin/swapon

Don Lewis truckman at FreeBSD.org
Sun Jan 26 01:42:48 UTC 2020


Author: truckman
Date: Sun Jan 26 01:42:47 2020
New Revision: 357132
URL: https://svnweb.freebsd.org/changeset/base/357132

Log:
  MFC r355553
  
  Fix a logic bug in error handling code.  It is an error if p == NULL.
  The linelen tests are only meaningful when p != NULL.
  
  Reported by:	Coverity
  Coverity CID:	1368655

Modified:
  stable/12/sbin/swapon/swapon.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/swapon/swapon.c
==============================================================================
--- stable/12/sbin/swapon/swapon.c	Sun Jan 26 00:41:38 2020	(r357131)
+++ stable/12/sbin/swapon/swapon.c	Sun Jan 26 01:42:47 2020	(r357132)
@@ -542,7 +542,7 @@ swap_on_off_md(const char *name, char *mntops, int doi
 				goto err;
 			}
 			p = fgetln(sfd, &linelen);
-			if (p == NULL &&
+			if (p == NULL ||
 			    (linelen < 2 || linelen > sizeof(linebuf))) {
 				warn("mdconfig (attach) unexpected output");
 				ret = NULL;


More information about the svn-src-all mailing list