svn commit: r357133 - stable/11/sbin/swapon

Don Lewis truckman at FreeBSD.org
Sun Jan 26 01:45:23 UTC 2020


Author: truckman
Date: Sun Jan 26 01:45:22 2020
New Revision: 357133
URL: https://svnweb.freebsd.org/changeset/base/357133

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/11/sbin/swapon/swapon.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/swapon/swapon.c
==============================================================================
--- stable/11/sbin/swapon/swapon.c	Sun Jan 26 01:42:47 2020	(r357132)
+++ stable/11/sbin/swapon/swapon.c	Sun Jan 26 01:45:22 2020	(r357133)
@@ -521,7 +521,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