ensure url escaped buffer is zero terminated