Call of memcmp with null pointers in obj_cmp()
[openssl.git] / crypto / objects / obj_dat.c
index e42a1c147de8e8bfd9fc2834e244ea4762b226ae..5ff1294d3c45f26063b7a47d6783c897dca76e3a 100644 (file)
@@ -142,7 +142,7 @@ static unsigned long added_obj_hash(const ADDED_OBJ *ca)
         return 0;
     }
     ret &= 0x3fffffffL;
-    ret |= ca->type << 30L;
+    ret |= ((unsigned long)ca->type) << 30L;
     return (ret);
 }
 
@@ -400,6 +400,8 @@ static int obj_cmp(const ASN1_OBJECT *const *ap, const unsigned int *bp)
     j = (a->length - b->length);
     if (j)
         return (j);
+    if (a->length == 0)
+        return 0;
     return (memcmp(a->data, b->data, a->length));
 }