Bug 496643

Summary: Possible segfault in SSL_new()
Product: [Fedora] Fedora Reporter: Ondrej Vasik <ovasik>
Component: nss_compat_osslAssignee: Rob Crittenden <rcritten>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: kdudka, rcritten, rrelyea
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.9.5-2.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-02 16:35:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Ensure we have an SSL_CTX before doing work none

Description Ondrej Vasik 2009-04-20 13:56:01 UTC
Description of problem:
When calling SSL_new() with NULL argument in some application (e.g. it could happen with actual elinks devel branch, compiled, when its binary executed as `SSL_DIR=<some file, not nss database dir> ./elinks https://<somepage>` with SSL certification enabled), application will segfault.

Version-Release number of selected component (if applicable):
nss_compat_ossl-0.9.4-3

How reproducible:
always

Steps to Reproduce:
1. compile elinks binary, devel branch (linked with nss_compat_ossl)
2. run it's binary with invalid SSL_DIR envvar 
  
Actual results:
It will segfault

Expected results:
It will return some error 

Additional info:
Something like that patch fixes my problem, it could be of course handled/prevented on elinks side, but it would be better to prevent such things directly in library.

diff -urNp nss_compat_ossl-0.9.4-orig/src/ssl.c nss_compat_ossl-0.9.4/src/ssl.c
--- nss_compat_ossl-0.9.4-orig/src/ssl.c        2009-04-15 16:55:03.000000000 +0200
+++ nss_compat_ossl-0.9.4/src/ssl.c     2009-04-15 16:56:25.000000000 +0200
@@ -1968,6 +1968,9 @@ SSL *SSL_new(SSL_CTX *templ_s)
     ossl_ctx_t *ossl;
     ossl_ctx_t *ossl_templ;

+    if (templ_s == NULL)
+       return NULL;
+
     /* This layer contains the TCP/IP functions we need */
     s = PR_NewTCPSocket();
     if (s == NULL)

Comment 1 Rob Crittenden 2009-04-20 14:48:50 UTC
Your patch looks good, thanks.

I'll get this committed upstream and create a set of Fedora updates.

Comment 2 Rob Crittenden 2009-04-20 14:57:19 UTC
Created attachment 340360 [details]
Ensure we have an SSL_CTX before doing work

Comment 3 Rob Crittenden 2009-04-20 15:00:45 UTC
Committed revision 70.

Comment 4 Fedora Update System 2009-04-20 19:53:20 UTC
nss_compat_ossl-0.9.5-2.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/nss_compat_ossl-0.9.5-2.fc10

Comment 5 Fedora Update System 2009-04-20 19:53:25 UTC
nss_compat_ossl-0.9.5-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/nss_compat_ossl-0.9.5-1.fc11

Comment 6 Fedora Update System 2009-04-20 19:53:30 UTC
nss_compat_ossl-0.9.5-1.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/nss_compat_ossl-0.9.5-1.fc9

Comment 7 Fedora Update System 2009-04-22 00:49:17 UTC
nss_compat_ossl-0.9.5-2.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update nss_compat_ossl'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-3767

Comment 8 Fedora Update System 2009-04-22 00:54:02 UTC
nss_compat_ossl-0.9.5-1.fc9 has been pushed to the Fedora 9 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing-newkey update nss_compat_ossl'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2009-3796

Comment 9 Fedora Update System 2009-04-29 14:43:53 UTC
nss_compat_ossl-0.9.5-3.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/nss_compat_ossl-0.9.5-3.fc10

Comment 10 Fedora Update System 2009-04-29 14:44:03 UTC
nss_compat_ossl-0.9.5-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/nss_compat_ossl-0.9.5-2.fc11

Comment 11 Fedora Update System 2009-04-29 14:44:12 UTC
nss_compat_ossl-0.9.5-2.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/nss_compat_ossl-0.9.5-2.fc9

Comment 12 Fedora Update System 2009-05-02 16:35:27 UTC
nss_compat_ossl-0.9.5-2.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2009-05-02 16:36:35 UTC
nss_compat_ossl-0.9.5-3.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2009-05-09 04:04:02 UTC
nss_compat_ossl-0.9.5-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.