On Thu, Sep 22, 2016 at 09:03:57PM +0200, Markus Wichmann wrote:
> On Thu, Sep 22, 2016 at 08:04:44PM +0200, [email protected] wrote:
> > main.c:7:10: error: expected ???=???, ???,???, ???;???, ???asm??? or
> > ???__attribute__??? before ???void???
> > noreturn void __stack_chk_fail(void);
> noreturn is already a return type (in as much as void is one, namely
> syntactically), so remove the "void" and you should be fine.
>
> > tried
> > void __stack_chk_fail(void) __attribute ((noreturn));
> > instead.
> That however only works with gcc and compatibles.
Thanks for pointing out. In the meantime I wrote this, because I had a look at
libssp.
I will call it money :)
#include <string.h>
int main(int argc, char **argv) {
if (strstr(argv[1],"buf")) {
__chk_fail();
} else if (strstr(argv[1],"fmt")) {
__stack_chk_fail();
}
return 0;
}