lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] dereferenced NULL Pointer


From: Andreas Becker
Subject: [lwip-users] dereferenced NULL Pointer
Date: Thu, 29 Jul 2004 11:03:21 +0200

Hi all,

I was looking into the file contrib/ports/unix/sys_arch.c

In the function: 
sys_arch_mbox_fetch(struct sys_mbox *mbox, void **msg, u32_t timeout)

is the debug-statement

LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", (void *)mbox, 
*msg));

But the "msg" pointer can be NULL an so the debug function tries to 
dereference an NULL pointer. This leads to an Segmentation Fault.

In my opinion it is better to ask if "msg" is NULL and then just use another 
debug_statement like:

if (msg != NULL)
{
  LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", (void *)mbox,   
  *msg));
}
else
{
  LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", (void *)mbox, 
  msg));
}

I hope it's helpfull.

-- 
Dipl.-Ing.(FH) Andreas Becker
Entwicklung




reply via email to

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