svn commit: r355553 - head/sbin/swapon
Don Lewis
truckman at FreeBSD.org
Mon Dec 9 07:18:41 UTC 2019
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;
More information about the svn-src-head
mailing list