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.
*
* ***** 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 "cert.h"
@ -6783,23 +6783,25 @@ ssl3_SendCertificate(sslSocket *ss)
if (rv != SECSuccess) {
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
if (fakeCert.len > 0 && i == ndex) {
rv = ssl3_AppendHandshakeVariable(ss, fakeCert.data, fakeCert.len,
3);
SECITEM_FreeItem(&fakeCert, PR_FALSE);
} else {
rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data,
certChain->certs[i].len, 3);
}
if (fakeCert.len > 0 && i == ndex) {
rv = ssl3_AppendHandshakeVariable(ss, fakeCert.data,
fakeCert.len, 3);
SECITEM_FreeItem(&fakeCert, PR_FALSE);
} else {
rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data,
certChain->certs[i].len, 3);
}
#else
rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data,
certChain->certs[i].len, 3);
rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data,
certChain->certs[i].len, 3);
#endif
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
}
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
}
}
}
return SECSuccess;