Date: Sun, 26 Jan 2020 01:45:22 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r357133 - stable/11/sbin/swapon Message-ID: <202001260145.00Q1jMXs041058@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001260145.00Q1jMXs041058>