Created
September 20, 2021 11:46
-
-
Save JamesHovious/4589c81aa1a9d00599d0bb667832eb76 to your computer and use it in GitHub Desktop.
pointer to bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size := unsafe.Sizeof(ptr) | |
eip := make([]byte, size) | |
switch size { | |
case 4: binary.LittleEndian.PutUint32(eip, uint32(ptr)) | |
case 8: binary.LittleEndian.PutUint64(eip, uint64(ptr)) | |
default: panic(fmt.Sprintf(“unknown uintptr size: %v”, size)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment