Prevent buf2 buffer overflow by limiting the the amount of bytes printed

This commit is contained in:
Holger Vogt 2020-05-03 00:19:48 +02:00
parent 58a61c4c3b
commit 13c23fd71b
1 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,8 @@ pvec(struct dvec *d)
if (d->v_numdims > 1) {
dimstring(d->v_dims, d->v_numdims, buf3);
snprintf(buf2, BSIZE_SP, ", dims = [%s]", buf3);
size_t icopy = BSIZE_SP - 11;
snprintf(buf2, icopy, ", dims = [%s]", buf3);
strcat(buf, buf2);
}