def read_cstring(file_object):
    """ Read the 0-terminated string from file_object and return the bytes
    object (terminator excluded). """
    cstring = b""
    while True:
        char = file_object.read(1)
        if char and char != b"\x00":
            cstring += char
        else:
            break
    return cstring