> As far as I know, since there is no explicit cases in the switch
> statement, the value is not used at all, and the compiler never
generates code to dereference the pointer.
...
That is true. Thank you all for answers and for link.
http://blog.llvm.org/2011/05/what-every-c-programmer-should-k
> No ?
"Contrary to popular belief, dereferencing a null pointer in C is
undefined. It is not defined to trap, and if you mmap a page at 0,
it is not defined to access that page."
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html
On Mon, Sep 03, 2018 at 01:53:41PM +0200, Denis Buga wrote:
> int main()
> {
> char * ptr = NULL;
> switch( *ptr )
> {
> default:
> fprintf(stderr,
>
> "where is exception ? default label exist for"
> "exclusive value, not for non-existent ! "
>
> "it can be security issue, when dereferencing NULL
On Mon, Sep 3, 2018 at 7:53 AM, Denis Buga wrote:
> int main()
> {
> char * ptr = NULL;
> switch( *ptr )
> {
> default:
> fprintf(stderr,
>
> "where is exception ? default label exist for"
> "exclusive value, not for non-existent ! "
>
> "it can be security issue, when dereferencing NULL "
> "in s
int main()
{
char * ptr = NULL;
switch( *ptr )
{
default:
fprintf(stderr,
"where is exception ? default label exist for"
"exclusive value, not for non-existent ! "
"it can be security issue, when dereferencing NULL "
"in switch formally pass and we go to default label\n");
} }
No ?
6.3 GENERIC.
5 matches
Mail list logo