Skip to content

Commit

Permalink
fixed some bugs in the integer overlow program
Browse files Browse the repository at this point in the history
  • Loading branch information
ewimberley committed Nov 11, 2013
1 parent 29982c6 commit b6e816c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions 4.cpp
Expand Up @@ -8,13 +8,14 @@ int a(){
char buff[10];
printf("buff position: %p\n", buff);
printf("buff2 position: %p\n", buff2);
scanf("%d", &position);
scanf("%d\n", &position);
if(position < 0){
printf("nice try...\n");
exit(1);
}
position = position*2;
while(position < 10 && in){
in = 0;
while(position < 10 && in != '\n'){
scanf("%c", &in);
buff[position] = in;
printf("%d\n", position);
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -2,6 +2,6 @@ all:
g++ -I./ -g -o 1.bin -fstack-protector-all 1.cpp
g++ -I./ -g -o 2.bin -fstack-protector-all 2.cpp
g++ -I./ -g -o 3.bin -fstack-protector-all 3.cpp
g++ -I./ -g -o 4.bin -fstack-protector-all 4.cpp
g++-4.8 -I./ -g -o 4.bin -fsanitize=address 4.cpp
clean:
rm -f *.bin *.o *.so *_expanded.cpp

0 comments on commit b6e816c

Please sign in to comment.