Fix possible overflow in strbuf_append