def decode_key_string(buf, off: int) -> str:
    """Decodes a byte array at buf[off:] into string, stripping off null terminator"""
    i = buf[off:].find(b"\0")
    if i == -1:
        return buf[off:]
    return buf[off: off + i].decode("utf-8")