INET type and 00/0

Started by Bruce Momjianalmost 27 years ago1 messageshackers
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Why is this line here, the size-- line? It does not appear in the
inet_cidr_ntop_ipv4() function. This is maybe the cause of our 00/0.

---------------------------------------------------------------------------

static char *
inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
{
char *odst = dst;
char *t;
size_t len = 4;
int b, tb;

if (bits < 0 || bits > 32)
{
errno = EINVAL;
return (NULL);
}
if (bits == 0)
{
if (size < sizeof "0")
goto emsgsize;
*dst++ = '0';
size--;
*dst = '\0';
}

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026