def make_pattern(buffer_size, start_index=1, max_index=500):
    format_size = buffer_size // 2
    pattern_size = buffer_size // 8 
    
    index = start_index
    payload = msfpattern(pattern_size * 4)
    while True:
        fmt = "%" + str(index) + "$p"
        if len(payload) + len(fmt) > buffer_size:
            break
        payload += fmt
        index += 1 - pattern_size
        if index > max_index:
            break
    return payload.ljust(buffer_size, "X")
dataset/ETHPy150Open Gallopsled/pwntools-write-ups/wargames/overthewire-vortex/level4/libformatstr/pattern.py/make_pattern/swapped operands of `-`