summaryrefslogtreecommitdiff
path: root/bin/expr/expr.y
diff options
context:
space:
mode:
authorjdolecek <jdolecek@NetBSD.org>2000-09-29 17:49:21 +0000
committerjdolecek <jdolecek@NetBSD.org>2000-09-29 17:49:21 +0000
commitfd6eeb2e1dbbc18bd0c109491d6ff275c8e6b3bc (patch)
tree4a8e5441afd17c27c213ba7f68b2736154671d89 /bin/expr/expr.y
parent989e0d26136b4a93f77f346052526d739f2c7d18 (diff)
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 <ljt@alum.mit.edu> and reported in private e-mail.
Diffstat (limited to 'bin/expr/expr.y')
-rw-r--r--bin/expr/expr.y6
1 files changed, 3 insertions, 3 deletions
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 <sys/cdefs.h>
#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 <sys/types.h>
@@ -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 {