Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 2019 07:18:41 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355553 - head/sbin/swapon
Message-ID:  <201912090718.xB97IfB0096492@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Mon Dec  9 07:18:40 2019
New Revision: 355553
URL: https://svnweb.freebsd.org/changeset/base/355553

Log:
  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
  MFC after:	1 month

Modified:
  head/sbin/swapon/swapon.c

Modified: head/sbin/swapon/swapon.c
==============================================================================
--- head/sbin/swapon/swapon.c	Mon Dec  9 05:09:46 2019	(r355552)
+++ head/sbin/swapon/swapon.c	Mon Dec  9 07:18:40 2019	(r355553)
@@ -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;



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