Сообщение об ошибке Stack-Smashing Protection не содержит имя программы - PullRequest
0 голосов
/ 02 ноября 2019

Вот очень уродливая программа c:

#include <stdio.h>
 #include <string.h>
 int main(int argc, char *argv[])
 {
    char buffer[10];
    memcpy(buffer,argv[1],strlen(argv[1]));
    printf("%s\n", buffer);
    return 0;
 }

Я компилирую эту программу с помощью Stack-Smashing Protection:

 $ gcc -fstack-protector smash.c -o smash

Вот что я получаю во время выполнения:

 $ ./smash 01234567890
 01234567890v?\??nr?!??U
 *** stack smashing detected ***: <unknown> terminated
The protection works fine but i do not understand why i see instead of argv[0]

Спасибо

...