[RFC] coverity/68610: Fix out of bounds access

If buf is reallocated on 1708, it will be one character too short for
the terminating NULL character on 1712.
@oni-link Hm, I think you're right. I'll look into this some more.