ADELIM can be ‘}’ too, not just ‘/’, in code that checks for / vs. //

caught by new code after segfault report by bef0rd on IRC (thanks!)
This commit is contained in:
tg 2016-02-24 01:47:32 +00:00
parent e9fc158472
commit 08e1c6a9ea
2 changed files with 7 additions and 7 deletions

10
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.723 2016/02/11 20:19:44 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.724 2016/02/24 01:47:30 tg Exp $
# -*- mode: sh -*-
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -30,7 +30,7 @@
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
expected-stdout:
@(#)MIRBSD KSH R52 2016/01/21
@(#)MIRBSD KSH R52 2016/02/23
description:
Check version of shell.
stdin:
@ -39,7 +39,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R52 2016/01/21
@(#)LEGACY KSH R52 2016/02/23
description:
Check version of legacy shell.
stdin:
@ -1858,7 +1858,7 @@ stdin:
[[ -n $BASH_VERSION ]] && shopt -s extglob
x=1222321_ab/cde_b/c_1221
y=xyz
echo 1: ${x/2}
echo 1: ${x/2} . ${x/}
echo 2: ${x//2}
echo 3: ${x/+(2)}
echo 4: ${x//+(2)}
@ -1890,7 +1890,7 @@ stdin:
echo 30: ${x//\\a/9}
echo 31: ${x/2/$y}
expected-stdout:
1: 122321_ab/cde_b/c_1221
1: 122321_ab/cde_b/c_1221 . 1222321_ab/cde_b/c_1221
2: 131_ab/cde_b/c_11
3: 1321_ab/cde_b/c_1221
4: 131_ab/cde_b/c_11

4
eval.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.181 2016/01/21 18:24:38 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.182 2016/02/24 01:47:32 tg Exp $");
/*
* string expansion
@ -1151,7 +1151,7 @@ varsub(Expand *xp, const char *sp, const char *word,
if (!stype && c == '/') {
slen += 2;
stype = c;
if (word[slen] == ADELIM) {
if (word[slen] == ADELIM && word[slen + 1] == c) {
slen += 2;
stype |= 0x80;
}