From owner-svn-src-all@freebsd.org Sat Jul 30 04:40:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4D4CBA8D97; Sat, 30 Jul 2016 04:40:45 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id 775581BB7; Sat, 30 Jul 2016 04:40:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6U4eiqb040160; Sat, 30 Jul 2016 04:40:44 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6U4eihT040159; Sat, 30 Jul 2016 04:40:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607300440.u6U4eihT040159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 30 Jul 2016 04:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303538 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jul 2016 04:40:45 -0000 Author: ngie Date: Sat Jul 30 04:40:44 2016 New Revision: 303538 URL: https://svnweb.freebsd.org/changeset/base/303538 Log: Explicitly test for cu_fgets returning NULL or !NULL MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/sed/compile.c Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Sat Jul 30 03:43:55 2016 (r303537) +++ head/usr.bin/sed/compile.c Sat Jul 30 04:40:44 2016 (r303538) @@ -546,7 +546,7 @@ compile_subst(const char *p, struct s_su if ((text = realloc(text, asize)) == NULL) err(1, "realloc"); } - } while ((p = cu_fgets(&more))); + } while ((p = cu_fgets(&more)) != NULL); errx(1, "%lu: %s: unterminated substitute in regular expression", linenum, fname); /* NOTREACHED */ @@ -733,7 +733,7 @@ compile_text(size_t *ptlen) if ((text = malloc(asize)) == NULL) err(1, "malloc"); size = 0; - while ((p = cu_fgets(NULL))) { + while ((p = cu_fgets(NULL)) != NULL) { op = s = text + size; for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n')