0

I'm trying to understand the behavior of a buffer overflow and a shellcode. Basically when I compile the code, I receive the following warning :

gcc- -fno-stack-protector -z exestack -Wall -o buff buff.c
buff.c: In function ‘main’:
buff.c:19:2: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
  gets(buffer);
  ^~~~
  fgets
/usr/bin/x86_64-linux-gnu-ld: warning: -z exestack ignored.
/tmp/cctQkxAI.o: In function `main':
buff.c:(.text+0x28): warning: the `gets' function is dangerous and should not be used.

How can I resolve the warning regarding:

/usr/bin/x86_64-linux-gnu-ld: warning: -z exestack ignored.

I tried different version of gcc but I had the same problem.

CipherX
  • 371
  • 5
  • 18
  • I believe `gets` has been removed in later versions of the C standard. It may be available if you use `-std=c99` or similar. Also see [Why is the gets function so dangerous that it should not be used?](https://stackoverflow.com/q/1694036/608639) and Thomas Owens' answer. – jww Oct 05 '18 at 00:19
  • 4
    `execstack`, not `exestack`. – Shawn Oct 05 '18 at 02:00
  • As per the comment above that indeed removes the warning and answers the question, this question should be closed as `off-topic > typo` – Nino Filiu May 08 '19 at 11:54

0 Answers0