aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2019-03-25 16:08:07 -0700
committerRob Landley <rob@landley.net>2019-03-25 23:32:16 -0500
commit0b7206b22e7ef9d5d72079caa943592e313a6d65 (patch)
treebd26e668f03451381f821cdfe804af02349eabfb
parente954e37fbf92720533f59901513ce50e375c8abf (diff)
downloadtoybox-0b7206b22e7ef9d5d72079caa943592e313a6d65.tar.gz
Fix bc_vec_concat
BcVec contains the null at the end, so v->len is greater than strlen(v->v) by one.
-rw-r--r--toys/pending/bc.c4
1 files changed, 2 insertions, 2 deletions
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;
}