Re: make X509_CRL_METHOD_free() NULL-safe

2018-04-23 Thread Kinichiro Inoguchi
OK inoguchi@


Re: make X509_CRL_METHOD_free() NULL-safe

2018-04-23 Thread Brent Cook
OK bcook@

On Mon, Apr 23, 2018 at 3:27 AM, Theo Buehler  wrote:

> This is a practically unused function (both in our tree and globally),
> but it is the only remaining public *_free() function in libcrypto that
> segfaults on being passed NULL. I'll of course add it to the regress
> tests should this go in.
>
> Index: lib/libcrypto/asn1/x_crl.c
> ===
> RCS file: /var/cvs/src/lib/libcrypto/asn1/x_crl.c,v
> retrieving revision 1.30
> diff -u -p -r1.30 x_crl.c
> --- lib/libcrypto/asn1/x_crl.c  17 Mar 2018 14:33:20 -  1.30
> +++ lib/libcrypto/asn1/x_crl.c  22 Apr 2018 12:12:14 -
> @@ -675,7 +675,7 @@ X509_CRL_METHOD_new(int (*crl_init)(X509
>  void
>  X509_CRL_METHOD_free(X509_CRL_METHOD *m)
>  {
> -   if (!(m->flags & X509_CRL_METHOD_DYNAMIC))
> +   if (m == NULL || !(m->flags & X509_CRL_METHOD_DYNAMIC))
> return;
> free(m);
>  }
>


make X509_CRL_METHOD_free() NULL-safe

2018-04-23 Thread Theo Buehler
This is a practically unused function (both in our tree and globally),
but it is the only remaining public *_free() function in libcrypto that
segfaults on being passed NULL. I'll of course add it to the regress
tests should this go in.

Index: lib/libcrypto/asn1/x_crl.c
===
RCS file: /var/cvs/src/lib/libcrypto/asn1/x_crl.c,v
retrieving revision 1.30
diff -u -p -r1.30 x_crl.c
--- lib/libcrypto/asn1/x_crl.c  17 Mar 2018 14:33:20 -  1.30
+++ lib/libcrypto/asn1/x_crl.c  22 Apr 2018 12:12:14 -
@@ -675,7 +675,7 @@ X509_CRL_METHOD_new(int (*crl_init)(X509
 void
 X509_CRL_METHOD_free(X509_CRL_METHOD *m)
 {
-   if (!(m->flags & X509_CRL_METHOD_DYNAMIC))
+   if (m == NULL || !(m->flags & X509_CRL_METHOD_DYNAMIC))
return;
free(m);
 }