lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] accept differs from BSD/linux operation on NULL args


From: Rishi Khan
Subject: [lwip-users] accept differs from BSD/linux operation on NULL args
Date: Sat, 10 May 2008 00:25:09 -0400

in lwip_accept (in sockets.c) there is this code:

  memset(&sin, 0, sizeof(sin));
  sin.sin_len = sizeof(sin);
  sin.sin_family = AF_INET;
  sin.sin_port = htons(port);
  sin.sin_addr.s_addr = naddr.addr;

  if (*addrlen > sizeof(sin))
    *addrlen = sizeof(sin);

  SMEMCPY(addr, &sin, *addrlen);

When addrlen and or addr are NULL, this code crashes. Most BSD and linux implementations allow it to be NULL. Could/should we change this code to be enclosed in:
if (addr != NULL)
{
  ...
}

Thoughts?




reply via email to

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