#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#define e();
if(((unsigned int)ptr & 0xff000000)==0xca000000)
{
setresuid(geteuid(), geteuid(), geteuid()); execlp("/bin/sh", "sh", "-i", NULL);
}
void print(unsigned char *buf, int len)
{
int i;
printf("[ ");
for(i=0; i < len; i++) printf("%x ", buf[i]);
printf(" ]\n");
}
int main()
{
unsigned char buf[512];
unsigned char *ptr = buf + (sizeof(buf)/2);
unsigned int x;
while((x = getchar()) != EOF) {
switch(x) {
case '\n': print(buf, sizeof(buf)); continue; break;
case '\\': ptr--; break;
default: e(); if(ptr > buf + sizeof(buf)) continue; ptr++[0] = x; break;
}
}
printf("All done\n");
}
我的錯誤,包括.o文件將:| 8 |錯誤:預期標識符或「( 「之前‘如果’|我不能讓vortex1.c文件進行編譯,這也給了回來,當我試圖讓一個.exe文件
這是http://overthewire.org/wargames/vortex/vortex1.html直接複製,所以我承擔的語法是正確的
它不是一個直接複製......在鏈接中,'#define e();'和它下面的四行都在一行上。如果你想分解這樣一個宏,你必須在宏的行結尾之前加一個反斜槓。 – Dmitri
'e()'後面的分號令人困惑/有趣。它是'e()'擴展的一部分。這意味着在宏的文本之前'default:'之後有一個空的語句。奇怪的。無害,但很奇怪。 –
正如Dmitri所說,您需要將e()的擴展放在同一行中或使用反斜槓來轉義新行。其次,你能否提到你如何編寫代碼?標誌將是有用的。由於該文件有錯誤,我相信它也不會生成.o。它可能是以前的流浪。 –