341291: Coverity 689 - potential NULL ptr crash in ssl3_SendCertificate. r=nelson

This commit is contained in:
alexei.volkov.bugs%sun.com 2006-07-17 22:08:03 +00:00
Родитель 4d331091de
Коммит 9ea0404651
1 изменённых файлов: 17 добавлений и 15 удалений

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

@ -39,7 +39,7 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/* $Id: ssl3con.c,v 1.92 2006/06/26 23:32:19 wtchang%redhat.com Exp $ */ /* $Id: ssl3con.c,v 1.93 2006/07/17 22:08:03 alexei.volkov.bugs%sun.com Exp $ */
#include "nssrenam.h" #include "nssrenam.h"
#include "cert.h" #include "cert.h"
@ -6783,23 +6783,25 @@ ssl3_SendCertificate(sslSocket *ss)
if (rv != SECSuccess) { if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */ return rv; /* err set by AppendHandshake. */
} }
for (i = 0; i < certChain->len; i++) { if (certChain) {
for (i = 0; i < certChain->len; i++) {
#ifdef NISCC_TEST #ifdef NISCC_TEST
if (fakeCert.len > 0 && i == ndex) { if (fakeCert.len > 0 && i == ndex) {
rv = ssl3_AppendHandshakeVariable(ss, fakeCert.data, fakeCert.len, rv = ssl3_AppendHandshakeVariable(ss, fakeCert.data,
3); fakeCert.len, 3);
SECITEM_FreeItem(&fakeCert, PR_FALSE); SECITEM_FreeItem(&fakeCert, PR_FALSE);
} else { } else {
rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data, rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data,
certChain->certs[i].len, 3); certChain->certs[i].len, 3);
} }
#else #else
rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data, rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data,
certChain->certs[i].len, 3); certChain->certs[i].len, 3);
#endif #endif
if (rv != SECSuccess) { if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */ return rv; /* err set by AppendHandshake. */
} }
}
} }
return SECSuccess; return SECSuccess;