From 0b7206b22e7ef9d5d72079caa943592e313a6d65 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Mon, 25 Mar 2019 16:08:07 -0700 Subject: Fix bc_vec_concat BcVec contains the null at the end, so v->len is greater than strlen(v->v) by one. --- toys/pending/bc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/pending') diff --git a/toys/pending/bc.c b/toys/pending/bc.c index 142c0ce2..bb5d86cb 100644 --- a/toys/pending/bc.c +++ b/toys/pending/bc.c @@ -952,8 +952,8 @@ void bc_vec_concat(BcVec *v, char *str) { if (!v->len) bc_vec_pushByte(v, '\0'); len = strlen(str); - bc_vec_grow(v, len+1); - strcpy(v->v+v->len, str); + bc_vec_grow(v, len); + strcpy(v->v+v->len-1, str); v->len += len; } -- cgit v1.2.3