From owner-svn-src-stable-11@freebsd.org Sun Jan 26 01:45:23 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19A8022AE78; Sun, 26 Jan 2020 01:45:23 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 484wgQ6xwsz4PCw; Sun, 26 Jan 2020 01:45:22 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9CF8199AC; Sun, 26 Jan 2020 01:45:22 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00Q1jMwA041059; Sun, 26 Jan 2020 01:45:22 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00Q1jMXs041058; Sun, 26 Jan 2020 01:45:22 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <202001260145.00Q1jMXs041058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Sun, 26 Jan 2020 01:45:22 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: truckman X-SVN-Commit-Paths: stable/11/sbin/swapon X-SVN-Commit-Revision: 357133 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jan 2020 01:45:23 -0000 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;