summaryrefslogtreecommitdiff
path: root/debian/patches/check_null_sn_ln.patch
blob: b0ee4c4a88e06b533d2be5c53a367e877ca397d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
commit 3a9e237b1baddf0d3192755406befb3e9fa5ca80
Author: dann frazier <dann.frazier@canonical.com>
Date:   Thu Mar 7 19:55:42 2019 -0700

    Fix OBJ_create() to tolerate a NULL sn and ln
    
    From: https://github.com/openssl/openssl/commit/f13615c5b828aeb8e3d9bf2545c803633d1c684f
    
    Apply an upstream patch from OpenSSL to tolerate a NULL sn. This avoids
    a NULL pointer reference in shim.c:verify_eku(). This was discovered
    because it causes a crash on ARM where, unlike x86, it does not necessarily
    have memory mapped at 0x0.
    
    Fixes: 6c180c6004ac ("shim: verify Extended Key Usage flags")
    Signed-off-by: dann frazier <dann.frazier@canonical.com>

diff --git a/Cryptlib/OpenSSL/crypto/objects/obj_dat.c b/Cryptlib/OpenSSL/crypto/objects/obj_dat.c
index 259851b..9b850ed 100644
--- a/Cryptlib/OpenSSL/crypto/objects/obj_dat.c
+++ b/Cryptlib/OpenSSL/crypto/objects/obj_dat.c
@@ -685,7 +685,8 @@ int OBJ_create(const char *oid, const char *sn, const char *ln)
     int ok = 0;
 
     /* Check to see if short or long name already present */
-    if (OBJ_sn2nid(sn) != NID_undef || OBJ_ln2nid(ln) != NID_undef) {
+    if ((sn != NULL && OBJ_sn2nid(sn) != NID_undef)
+            || (ln != NULL && OBJ_ln2nid(ln) != NID_undef)) {
         OBJerr(OBJ_F_OBJ_CREATE, OBJ_R_OID_EXISTS);
         return 0;
     }