Fix the ${foo:0:} crash

ok ajacoutot@, jasper@
This commit is contained in:
pea 2011-03-04 10:08:59 +00:00
parent cae9a5e207
commit 1df7aa6506
2 changed files with 29 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.60 2011/02/03 08:56:14 pea Exp $
# $OpenBSD: Makefile,v 1.61 2011/03/04 10:08:59 pea Exp $
COMMENT= Z shell, Bourne shell-compatible
@ -6,7 +6,7 @@ V= 4.3.11
DISTNAME= zsh-$V
CATEGORIES= shells
REVISION= 1
REVISION= 2
MAINTAINER= Pierre-Emmanuel Andre <pea@openbsd.org>

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-Src_subst_c,v 1.1 2011/03/04 10:08:59 pea Exp $
Fix for ${foo:0:} crash
--- Src/subst.c.orig Thu Dec 16 10:26:50 2010
+++ Src/subst.c Thu Mar 3 15:14:28 2011
@@ -2814,12 +2814,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt,
zerr("invalid length: %s", check_offset);
return NULL;
}
- length = mathevali(check_offset);
- if (errflag)
- return NULL;
- if (length < (zlong)0) {
- zerr("invalid length: %s", check_offset);
- return NULL;
+ if (check_offset) {
+ length = mathevali(check_offset);
+ if (errflag)
+ return NULL;
+ if (length < (zlong)0) {
+ zerr("invalid length: %s", check_offset);
+ return NULL;
+ }
}
}
if (horrible_offset_hack) {