Index: mozilla/security/nss/lib/util/derenc.c =================================================================== RCS file: /cvsroot/mozilla/security/nss/lib/util/derenc.c,v retrieving revision 1.2 diff -pU12 -r1.2 mozilla/security/nss/lib/util/derenc.c --- mozilla/security/nss/lib/util/derenc.c +++ mozilla/security/nss/lib/util/derenc.c @@ -115,27 +115,29 @@ header_length(DERTemplate *dtemplate, ui if (encode_kind & DER_POINTER) { if (dtemplate->sub != NULL) { under_kind = dtemplate->sub->kind; if (universal) { encode_kind = under_kind; } } else if (universal) { under_kind = encode_kind & ~DER_POINTER; } else { under_kind = dtemplate->arg; } } else if (encode_kind & DER_INLINE) { - under_kind = dtemplate->sub->kind; - if (universal) { - encode_kind = under_kind; + if (dtemplate->sub != NULL) { + under_kind = dtemplate->sub->kind; + if (universal) { + encode_kind = under_kind; + } } } else if (universal) { under_kind = encode_kind; } else { under_kind = dtemplate->arg; } /* This is only used in decoding; it plays no part in encoding. */ if (under_kind & DER_DERPTR) return 0; /* No header at all for an "empty" optional. */