From owner-svn-src-all@FreeBSD.ORG Sat Feb 28 06:27:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 072C3106566C; Sat, 28 Feb 2009 06:27:24 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E94CF8FC12; Sat, 28 Feb 2009 06:27:23 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1S6RNcP097688; Sat, 28 Feb 2009 06:27:23 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1S6RNIj097687; Sat, 28 Feb 2009 06:27:23 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200902280627.n1S6RNIj097687@svn.freebsd.org> From: David Schultz Date: Sat, 28 Feb 2009 06:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189139 - head/contrib/less X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 28 Feb 2009 06:27:24 -0000 Author: das Date: Sat Feb 28 06:27:23 2009 New Revision: 189139 URL: http://svn.freebsd.org/changeset/base/189139 Log: Make `less -R' not crash all the time. Modified: head/contrib/less/line.c Modified: head/contrib/less/line.c ============================================================================== --- head/contrib/less/line.c Sat Feb 28 06:06:57 2009 (r189138) +++ head/contrib/less/line.c Sat Feb 28 06:27:23 2009 (r189139) @@ -601,9 +601,11 @@ store_char(ch, a, rep, pos) { if (!is_ansi_end(ch) && !is_ansi_middle(ch)) { /* Remove whole unrecognized sequence. */ - do { + while (curr) { --curr; - } while (!IS_CSI_START(linebuf[curr])); + if (IS_CSI_START(linebuf[curr])) + break; + } return 0; } a = AT_ANSI; /* Will force re-AT_'ing around it. */