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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to