From 9b31399aecc19e7f2b2fd103188e2b56984db18e Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 19 Nov 2014 18:44:11 +0000 Subject: [PATCH] =?UTF-8?q?fix=20buffer=20overflow=20found=20by=20zacts=20?= =?UTF-8?q?from=20IRC=20(bad=20length=20calculation)=20now=20zsh=20and=20m?= =?UTF-8?q?ksh=20are=20even=E2=80=A6=20:|?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check.t | 6 +++--- lex.c | 4 ++-- sh.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/check.t b/check.t index d994c36..99c2467 100644 --- a/check.t +++ b/check.t @@ -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: diff --git a/lex.c b/lex.c index 9d39998..a9b5ecd 100644 --- a/lex.c +++ b/lex.c @@ -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 == '\\') { diff --git a/sh.h b/sh.h index dbfc4a8..10e2069 100644 --- a/sh.h +++ b/sh.h @@ -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