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.