summaryrefslogtreecommitdiffstats
path: root/bin/expr/expr.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-04-15 08:34:04 +0000
committerderaadt <deraadt@openbsd.org>2003-04-15 08:34:04 +0000
commit8b14c5c5a49b26f7376aa27d575620825b2c6673 (patch)
tree7a07d795368e9e16fb14976d5dad7254d4efe16e /bin/expr/expr.c
parentvarious cleaning (diff)
downloadwireguard-openbsd-8b14c5c5a49b26f7376aa27d575620825b2c6673.tar.xz
wireguard-openbsd-8b14c5c5a49b26f7376aa27d575620825b2c6673.zip
use a variable
Diffstat (limited to 'bin/expr/expr.c')
-rw-r--r--bin/expr/expr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/expr/expr.c b/bin/expr/expr.c
index c8119bcd708..d87cb15505b 100644
--- a/bin/expr/expr.c
+++ b/bin/expr/expr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expr.c,v 1.12 2002/07/04 04:26:39 deraadt Exp $ */
+/* $OpenBSD: expr.c,v 1.13 2003/04/15 08:34:04 deraadt Exp $ */
/* $NetBSD: expr.c,v 1.3.6.1 1996/06/04 20:41:47 cgd Exp $ */
/*
@@ -141,15 +141,17 @@ void
to_string(struct val *vp)
{
char *tmp;
+ size_t len;
if (vp->type == string)
return;
- tmp = malloc(25);
+ len = 25;
+ tmp = malloc(len);
if (tmp == NULL) {
err(3, NULL);
}
- snprintf(tmp, 25, "%d", vp->u.i);
+ snprintf(tmp, len, "%d", vp->u.i);
vp->type = string;
vp->u.s = tmp;
}