In usr.bin/tar/tree.c, if you really want to poke to NULL, you must use

volatile, otherwise the indirection will not be emitted.

MFC after:	1 week
This commit is contained in:
Dimitry Andric 2011-12-17 01:36:50 +00:00
parent 7824741286
commit 940695fffb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228616

View File

@ -315,7 +315,7 @@ tree_next(struct tree *t)
const char *msg = "Unable to continue traversing"
" directory hierarchy after a fatal error.";
write(2, msg, strlen(msg));
*(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */
*(volatile int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */
exit(1); /* In case the SEGV didn't work. */
}