From 4bab03c0f6533199ceb44c91df2f3a7196d4a791 Mon Sep 17 00:00:00 2001 From: "wchang0222%aol.com" Date: Fri, 24 Oct 2003 17:17:37 +0000 Subject: [PATCH] Bugzilla bug 173715: fixed a crash in OCSP. We incorrectly assumed that 'addr' was the last IP address of the host when PR_EnumerateHostEnt returned 0 and attempted to connect to 'addr', resulting in an assertion failure in PR_Connect. The fix is to not use 'addr' when PR_EnumerateHostEnt returns 0. r=relyea. --- security/nss/lib/certhigh/ocsp.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/security/nss/lib/certhigh/ocsp.c b/security/nss/lib/certhigh/ocsp.c index 0ad01950cbbe..af0bd4dda930 100644 --- a/security/nss/lib/certhigh/ocsp.c +++ b/security/nss/lib/certhigh/ocsp.c @@ -35,7 +35,7 @@ * Implementation of OCSP services, for both client and server. * (XXX, really, mostly just for client right now, but intended to do both.) * - * $Id: ocsp.c,v 1.16 2003/09/30 01:15:43 jpierre%netscape.com Exp $ + * $Id: ocsp.c,v 1.17 2003/10/24 17:17:37 wchang0222%aol.com Exp $ */ #include "prerror.h" @@ -1757,13 +1757,9 @@ ocsp_ConnectToHost(const char *host, PRUint16 port) hostIndex = 0; do { hostIndex = PR_EnumerateHostEnt(hostIndex, &hostEntry, port, &addr); - if (hostIndex < 0) + if (hostIndex <= 0) goto loser; - } while (PR_Connect(sock, &addr, timeout) != PR_SUCCESS - && hostIndex > 0); - - if (hostIndex == 0) - goto loser; + } while (PR_Connect(sock, &addr, timeout) != PR_SUCCESS); PORT_Free(netdbbuf); } else {