[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Potential NULL pointer access in ip4_frag.c

From: Andreas Dinter
Subject: Re: [lwip-users] Potential NULL pointer access in ip4_frag.c
Date: Thu, 27 Apr 2017 11:41:25 +0200

Thanks for your response.

>   Not having access to that specific version of LwIP

The line is actually part of the latest stable version (2.0.2). It just
moved a few lines up:

>   The only way the compiler can KNOW you're not dereferencing
>   a null pointer is for you to check for null explicitly first

Yes, you are right. When adding the additional check, the warning
disappears. This feels to me like the best solution, since assertions do not
have to be enabled in every case and they do not implement real error

One additional note: If the check is not there and assertions are disabled,
gcc may insert an undefined instruction "udf" (or 0xdeff). I am working with
an Cortex-M7 controller. If executed, the instruction will cause an
HardFault for an undefined instruction. I stumbled over this issue, by
searching for this instruction in the disassembly. This is the only location
in lwIP, where I found this issue.

I would really like to get rid of this invalid instruction, since this feels
to me like a bug, even if it will never be executed...

Best regards,

PS: Can you please keep me in CC, so that I am able to answer directly to

reply via email to

[Prev in Thread] Current Thread [Next in Thread]