gcc에서는 잘 작동합니다.Visual C++에서 함수 포인터로 캐스팅하여 쉘 코드를 실행하십시오.
unsigned char b[50] = "\xda\xd1 ... \x0"; //some shellcode with terminating \x0
((void(*)())b)(); //cast b to function pointer from void to void, then run it
그러나 이것은 비주얼 C++에 넣어 때,이 오류 메시지가 뱉어 : 왜 이렇게되는지
1>..\test.cpp(132): error C2440: 'type cast' : cannot convert from 'unsigned char [50]' to 'void (__cdecl *)(void)'
1> There is no context in which this conversion is possible
아는 사람을 코드는 무언가 같이 간다? 다른 형식으로 데이터를 재 해석
'(* (void (*)()) & b [0])()'을 시도해보십시오. –
어떻게 든이 일을하게 되더라도, 그것은 아주 나쁜 생각입니다. –
또는'reinterpret_cast (static_cast (b))()'. –