Skip to content

Instantly share code, notes, and snippets.

@jpauli
Created January 29, 2014 10:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpauli/8685734 to your computer and use it in GitHub Desktop.
Save jpauli/8685734 to your computer and use it in GitHub Desktop.
memcpy() with a sizeof(void *) size just nicely uses mov
160 char *str1 = "mystring";
7ffff6240c71: lea 0xf2(%rip),%rax # 0x7ffff6240d6a
7ffff6240c78: mov %rax,-0x8(%rbp)
161 char *str2 = NULL;
7ffff6240c7c: movq $0x0,-0x10(%rbp)
165 memcpy(&str2, &str1, sizeof(char *));
7ffff6240c84: mov -0x8(%rbp),%rax
7ffff6240c88: mov %rax,-0x10(%rbp)
160 char *str1 = "mystring";
7ffff6240c71: lea 0xf2(%rip),%rax # 0x7ffff6240d6a
7ffff6240c78: mov %rax,-0x8(%rbp)
161 char *str2 = NULL;
7ffff6240c7c: movq $0x0,-0x10(%rbp)
164 str2 = str1;
7ffff6240c84: mov -0x8(%rbp),%rax
7ffff6240c88: mov %rax,-0x10(%rbp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment