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.
This commit is contained in:
wchang0222%aol.com 2003-10-24 17:17:37 +00:00
Родитель 20bf2c30ea
Коммит 4bab03c0f6
1 изменённых файлов: 3 добавлений и 7 удалений

Просмотреть файл

@ -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 {