Skip to content

Instantly share code, notes, and snippets.

@JamesHovious
Created September 20, 2021 11:46
Show Gist options
  • Save JamesHovious/4589c81aa1a9d00599d0bb667832eb76 to your computer and use it in GitHub Desktop.
Save JamesHovious/4589c81aa1a9d00599d0bb667832eb76 to your computer and use it in GitHub Desktop.
pointer to bytes
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