aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorDon Lewis <truckman@FreeBSD.org>2019-12-09 07:18:40 +0000
committerDon Lewis <truckman@FreeBSD.org>2019-12-09 07:18:40 +0000
commit1bf6738f8002c49ff469f7c42a9de11833cd501b (patch)
tree66996613a86dd64d72cbf3c7fcf531469beb2c21 /sbin
parent7887f00d2babcb9c26b8e93585b65eb4c641551a (diff)
downloadsrc-1bf6738f8002c49ff469f7c42a9de11833cd501b.tar.gz
src-1bf6738f8002c49ff469f7c42a9de11833cd501b.zip
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
Notes
Notes: svn path=/head/; revision=355553
Diffstat (limited to 'sbin')
-rw-r--r--sbin/swapon/swapon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c
index 7eaa642ffb3c..04b3b9f6ac20 100644
--- a/sbin/swapon/swapon.c
+++ b/sbin/swapon/swapon.c
@@ -542,7 +542,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
goto err;
}
p = fgetln(sfd, &linelen);
- if (p == NULL &&
+ if (p == NULL ||
(linelen < 2 || linelen > sizeof(linebuf))) {
warn("mdconfig (attach) unexpected output");
ret = NULL;