Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Issue 7995009: net: fix crash when failing to import a client-side cert into NSS. (Closed)

Created:
9 years, 3 months ago by agl
Modified:
9 years, 2 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

net: fix crash when failing to import a client-side cert into NSS. (See the attached bug for details of the crash.) I believe the crash happens here (secitem.c:240): SECStatus SECITEM_CopyItem(PRArenaPool *arena, SECItem *to, const SECItem *from) { to->type = from->type; This is called from sslplatf.c:87: for (len = 0, node = CERT_LIST_HEAD(list); !CERT_LIST_END(node, list); len++, node = CERT_LIST_NEXT(node)) { // Check to see if the last cert to be sent is a self-signed cert, // and if so, omit it from the list of certificates. However, if // there is only one cert (len == 0), include the cert, as it means // the EE cert is self-signed. if (len > 0 && (len == chain->len - 1) && node->cert->isRoot) { chain->len = len; break; } SECITEM_CopyItem(arena, &chain->certs[len], &node->cert->derCert); } I think node->cert is NULL an that the compiler is confusing things by having SECITEM_CopyItem on the stack. The list of certs eventually comes from SSLClientSocketNSS::PlatformClientAuthHandler which doesn't check for NULL results when importing the certificates. The reporter notes that the certificate had a duplicate issuer and serial, which does cause NSS to reject certificates in some cases. BUG=97355 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=102943

Patch Set 1 #

Total comments: 2

Patch Set 2 : ... #

Total comments: 9

Patch Set 3 : ... #

Patch Set 4 : ... #

Patch Set 5 : ... #

Patch Set 6 : ... #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -17 lines) Patch
M net/socket/ssl_client_socket_nss.cc View 1 2 3 4 5 4 chunks +37 lines, -17 lines 5 comments Download
M net/socket/ssl_server_socket_nss.cc View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
agl
9 years, 3 months ago (2011-09-22 17:54:37 UTC) #1
wtc
mattm: could you also review this patch? Thanks.
9 years, 3 months ago (2011-09-22 17:56:38 UTC) #2
mattm
I also found another call of CERT_NewTempCertificate without checking the result in ssl_server_socket_nss.cc:370 http://codereview.chromium.org/7995009/diff/1/net/socket/ssl_client_socket_nss.cc File ...
9 years, 3 months ago (2011-09-22 21:31:18 UTC) #3
agl
http://codereview.chromium.org/7995009/diff/1/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7995009/diff/1/net/socket/ssl_client_socket_nss.cc#newcode2338 net/socket/ssl_client_socket_nss.cc:2338: os_error = errKCCreateChainFailed; On 2011/09/22 21:31:19, mattm wrote: > ...
9 years, 3 months ago (2011-09-22 22:07:09 UTC) #4
mattm
http://codereview.chromium.org/7995009/diff/6001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7995009/diff/6001/net/socket/ssl_client_socket_nss.cc#newcode2174 net/socket/ssl_client_socket_nss.cc:2174: return SECFailure; Oh, these two cases also need to ...
9 years, 3 months ago (2011-09-22 23:19:21 UTC) #5
wtc
Review comments on Patch Set 2: Now that I actually looked at the CL, I ...
9 years, 3 months ago (2011-09-23 00:55:54 UTC) #6
agl
http://codereview.chromium.org/7995009/diff/6001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7995009/diff/6001/net/socket/ssl_client_socket_nss.cc#newcode2165 net/socket/ssl_client_socket_nss.cc:2165: *result_certs = CERT_NewCertList(); On 2011/09/23 00:55:55, wtc wrote: > ...
9 years, 3 months ago (2011-09-23 17:52:22 UTC) #7
wtc
LGTM on Patch Set 6. My main concern is that I've never seen the INVALID_HANDLE ...
9 years, 3 months ago (2011-09-23 19:53:34 UTC) #8
Ryan Sleevi
LGTM, modulo possible Mac cleanup. I'm a bit surprised that NSS would reject a certificate ...
9 years, 3 months ago (2011-09-23 22:33:49 UTC) #9
wtc
rsleevi: thanks a lot for the code review. On 2011/09/23 22:33:49, Ryan Sleevi wrote: > ...
9 years, 3 months ago (2011-09-23 22:52:12 UTC) #10
wtc
http://codereview.chromium.org/7995009/diff/11003/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7995009/diff/11003/net/socket/ssl_client_socket_nss.cc#newcode2315 net/socket/ssl_client_socket_nss.cc:2315: *result_certs = CERT_NewCertList(); On 2011/09/23 22:33:50, Ryan Sleevi wrote: ...
9 years, 2 months ago (2011-09-26 18:26:07 UTC) #11
commit-bot: I haz the power
CQ is trying tha patch. Follow status at https://chromium-status.appspot.com/cq/agl@chromium.org/7995009/11003
9 years, 2 months ago (2011-09-26 19:38:36 UTC) #12
commit-bot: I haz the power
9 years, 2 months ago (2011-09-26 20:01:07 UTC) #13
Try job failure for 7995009-11003 (retry) on win_rel for step "compile" (clobber
build).
It's a second try, previously, step "compile" failed.
http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&nu...

Powered by Google App Engine
This is Rietveld 408576698