fix buffer overflow found by zacts from IRC (bad length calculation)

now zsh and mksh are even… :|
This commit is contained in:
tg 2014-11-19 18:44:11 +00:00
parent 8d9d86ceab
commit 9b31399aec
3 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.669 2014/11/14 20:21:27 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.670 2014/11/19 18:44:09 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://svnweb.freebsd.org/base/head/bin/test/tests/legacy_test.sh?view=co&content-type=text%2Fplain
expected-stdout:
@(#)MIRBSD KSH R50 2014/11/14
@(#)MIRBSD KSH R50 2014/11/19
description:
Check version of shell.
stdin:
@ -36,7 +36,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R50 2014/11/14
@(#)LEGACY KSH R50 2014/11/19
description:
Check version of legacy shell.
stdin:

4
lex.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.193 2014/06/29 11:28:28 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.194 2014/11/19 18:44:11 tg Exp $");
/*
* states while lexing word
@ -854,7 +854,7 @@ yylex(int cf)
*dp = '\0';
/* store the quoted string */
*wp++ = OQUOTE;
XcheckN(ws, wp, (dp - sp));
XcheckN(ws, wp, (dp - sp) * 2);
dp = sp;
while ((c = *dp++)) {
if (c == '\\') {

4
sh.h
View File

@ -169,9 +169,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.702 2014/11/14 20:21:29 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.703 2014/11/19 18:44:11 tg Exp $");
#endif
#define MKSH_VERSION "R50 2014/11/14"
#define MKSH_VERSION "R50 2014/11/19"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES