我正在测试缓冲区溢出利用,但是当我编译代码时,gcc使用内存对齐,编译器添加的额外字节迫使我处理这个填充.
有没有办法用gcc编译代码而没有填充?
这是使用填充实现的溢出,但我想要一个没有编译器垃圾的清晰视图:
(gdb) x/60x 0xbffff450
0xbffff450: 0xbffff460 0x00000001 0x00000000 0x00000001
0xbffff460: *0x41414141 0x41414141 0x41414141 0x41414141[buffer begins]
0xbffff470: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff480: 0x41414141 0x41414141 0x41414141 0x41414141
0xbffff490: 0x41414141 0x41414141 0x41414141 0x41414141*[buffer ends]
0xbffff4a0: 0x41414141 0x41414141 0x41414141 [0x0804851c][Return Address]
Run Code Online (Sandbox Code Playgroud)
问候
编辑:
这是我正在编译的代码:
#include <stdio.h>
char *secret = "pepito";
void go_shell(){
char *shell = "/bin/sh";
char *cmd[] = { "/bin/sh", 0 };
printf("¿Quieres jugar a un juego?...\n");
setreuid(0);
execve(shell,cmd,0);
}
int authorize(){
char password[64];
printf("Escriba la contraseña: ");
gets(password);
if (!strcmp(password,secret)) …
Run Code Online (Sandbox Code Playgroud) 我在模拟器启动时收到错误.我知道ADT插件和用户家有一个已知问题,但我认为我的问题有点不同.
当我尝试启动模拟器时,我收到此错误:
PANIC: Could not open AVD config file: C:\Users\Adrián\.android\avd\sda.avd/config.ini
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,用户名已从Adrián(在ADT中配置)更改为Adrián并且系统无法识别.我试图设置ANDROID_SDK_HOME和user.home变量,但它不起作用.
我想问题是我的用户名中的重音.有任何想法吗?问候.
嗨,我有一个列表列表,我需要比较每个列表的值与从XML文件中提取的另一个列表.结构类似于:
[('example', '123', 'foo', 'bar'), ('example2', '456', 'foo', 'bar'), ...]
Run Code Online (Sandbox Code Playgroud)
我需要将每个列表的第二个值与XML中的值进行比较:
for item in main_list:
for child in xml_data:
if item[4] == child.get('value'):
print item[4]
Run Code Online (Sandbox Code Playgroud)
问题是main_list有大量的行(1000+),并且乘以xml(100+)的值会导致很多迭代变得非常有效.
有没有办法有效地做到这一点?
问候.