Commit 3b12edaf authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vcc: Avoid suspicious truncation with pdiff()

Flexelint complains that this truncation is suspicious, which is fair.
The pdiff() function allows for a more expressive, and hopefully less
suspicious alternative with a bit of hardening in the process.
parent 001485e6
......@@ -351,7 +351,7 @@ vcc_decstr(struct vcc *tl, unsigned sep)
unsigned int l;
assert(tl->t->tok == CSTR);
l = (tl->t->e - tl->t->b) - (sep * 2);
l = pdiff(tl->t->b + sep, tl->t->e - sep);
tl->t->dec = TlAlloc(tl, l + 1);
AN(tl->t->dec);
q = tl->t->dec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment