add payload size check

This commit is contained in:
trisz404 2018-05-02 16:05:05 +02:00
parent 620a89471f
commit e7b42b9279

View File

@ -474,6 +474,10 @@ payload_length = len(payload)
padding_size = 0x1000 - (payload_length % 0x1000) padding_size = 0x1000 - (payload_length % 0x1000)
payload += (b'\0' * padding_size) payload += (b'\0' * padding_size)
if len(payload) > length:
print("ERROR: Too large payload! (%x vs %x)" % (len(payload), length))
sys.exit(-2)
# Send the constructed payload, which contains the command, the stack smashing # Send the constructed payload, which contains the command, the stack smashing
# values, the Intermezzo relocation stub, and the final payload. # values, the Intermezzo relocation stub, and the final payload.
print("Uploading payload...") print("Uploading payload...")