fix rare infinite loop when invalid UTF-8 is in the edit buffer

From: Ivan “Colona” Delalande <colona@ycc.fr>
This commit is contained in:
tg 2014-07-13 11:34:29 +00:00
parent 9b1d8d9f04
commit 0eb5044ac6
3 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.654 2014/06/29 11:28:26 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.655 2014/07/13 11:34:26 tg Exp $
# OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -27,7 +27,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R50 2014/06/29
@(#)MIRBSD KSH R50 2014/07/13
description:
Check version of shell.
stdin:
@ -36,7 +36,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R50 2014/06/29
@(#)LEGACY KSH R50 2014/07/13
description:
Check version of legacy shell.
stdin:

4
edit.c
View File

@ -28,7 +28,7 @@
#ifndef MKSH_NO_CMDLINE_EDITING
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.275 2014/01/05 21:57:24 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.276 2014/07/13 11:34:28 tg Exp $");
/*
* in later versions we might use libtermcap for this, but since external
@ -1628,7 +1628,7 @@ x_zots(char *str)
int adj = x_adj_done;
x_lastcp();
while (*str && str < xlp && adj == x_adj_done)
while (*str && str < xlp && x_col < xx_cols && adj == x_adj_done)
x_zotc3(&str);
}

4
sh.h
View File

@ -169,9 +169,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.691 2014/06/29 11:28:28 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.692 2014/07/13 11:34:29 tg Exp $");
#endif
#define MKSH_VERSION "R50 2014/06/29"
#define MKSH_VERSION "R50 2014/07/13"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES