From fd6eeb2e1dbbc18bd0c109491d6ff275c8e6b3bc Mon Sep 17 00:00:00 2001 From: jdolecek Date: Fri, 29 Sep 2000 17:49:21 +0000 Subject: in regexp handling code, fix the format passed to asprintf() to be actually in intended form - use "%.*s" and not incorrect "%*s" Bug found by Launey Thomas and reported in private e-mail. --- bin/expr/expr.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/expr/expr.y') diff --git a/bin/expr/expr.y b/bin/expr/expr.y index b662aabf9c7..cb45429e72b 100644 --- a/bin/expr/expr.y +++ b/bin/expr/expr.y @@ -1,4 +1,4 @@ -/* $NetBSD: expr.y,v 1.18 2000/09/21 20:32:24 jdolecek Exp $ */ +/* $NetBSD: expr.y,v 1.19 2000/09/29 17:49:21 jdolecek Exp $ */ /*_ * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ %{ #include #ifndef lint -__RCSID("$NetBSD: expr.y,v 1.18 2000/09/21 20:32:24 jdolecek Exp $"); +__RCSID("$NetBSD: expr.y,v 1.19 2000/09/29 17:49:21 jdolecek Exp $"); #endif /* not lint */ #include @@ -119,7 +119,7 @@ expr: item { $$ = $1; } if (regexec(&rp, $1, 2, rm, 0) == 0 && rm[0].rm_so == 0) { char *val; if (rm[1].rm_so >= 0) { - (void) asprintf(&val, "%*s", + (void) asprintf(&val, "%.*s", (int) (rm[1].rm_eo - rm[1].rm_so), $1 + rm[1].rm_so); } else { -- cgit