From: Bruce Momjian Date: Tue, 25 May 1999 05:29:38 +0000 (+0000) Subject: FIx for 0.0.0.0/0 output as 00/0. X-Git-Tag: REL6_5~170 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6bf0db7e07f6646bb1fe951bf4a274b98f4ca518;p=postgresql FIx for 0.0.0.0/0 output as 00/0. --- diff --git a/src/backend/utils/adt/inet_net_ntop.c b/src/backend/utils/adt/inet_net_ntop.c index d8cd2ff449..8c185dc83c 100644 --- a/src/backend/utils/adt/inet_net_ntop.c +++ b/src/backend/utils/adt/inet_net_ntop.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.4 1999/01/01 04:17:13 momjian Exp $"; +static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 1999/05/25 05:29:38 momjian Exp $"; #endif @@ -207,7 +207,7 @@ inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) /* Format whole octets plus nonzero trailing octets. */ tb = (bits == 32) ? 31 : bits; - for (b = 0; b <= (tb / 8) || (b < len && *src != 0); b++) + for (b = 0; bits != 0 && (b <= (tb / 8) || (b < len && *src != 0)); b++) { if (size < sizeof "255.") goto emsgsize;