RE: [Challenge] Get Shell via BOF 02-23-2014, 02:35 AM
#9
Compile the following using -fpermissive( system expects a const char, not a char ), it's the same code except for the declaration of types.
Code:
#include <stdio.h>
#include <stdlib.h>
class Test{
public:
Test(){
command[0] = 'l';
command[1] = 's';
command[2] = '\0';
}
void a(){
scanf("%s", buffer);
system(command);
}
private:
char buffer[10];
char command[10];
};
int main(){
Test aTest = Test();
aTest.a();
}