diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-07-13 00:52:45 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-07-13 00:55:58 +0530 |
commit | 35b6647d7b4daa5fe346e2452a4303b79702210f (patch) | |
tree | c8c8c57d63250b4357b972d5b9ecbfe6ccb432c8 /recipes/openssl | |
parent | 718e3768c568ffa8c49475bde931478d65e61655 (diff) |
openssl.recipe: Fix segfault on latest macOS
info.dli_fname is const char* and process-wide. We cannot modify it.
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/891>
Diffstat (limited to 'recipes/openssl')
-rw-r--r-- | recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch b/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch index ebeef746..16756227 100644 --- a/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch +++ b/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch @@ -64,7 +64,7 @@ diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c index 237b362..5f67759 100644 --- a/crypto/x509/by_file.c +++ b/crypto/x509/by_file.c -@@ -17,6 +17,49 @@ +@@ -17,6 +17,56 @@ #include <openssl/pem.h> #include "x509_local.h" @@ -85,27 +85,34 @@ index 237b362..5f67759 100644 +char * +_get_portable_X509_cert_file (void) +{ -+ char *p; ++ char *fname, *p; + char certfile[PATH_MAX]; + + Dl_info info; + if (!dladdr(_get_portable_X509_cert_file, &info)) + return NULL; + ++ fname = strdup(info.dli_fname); ++ + /* Get dylib directory: PREFIX/lib */ -+ if ((p = strrchr(info.dli_fname, '/')) == NULL) -+ return NULL; ++ if ((p = strrchr(fname, '/')) == NULL) ++ goto err; + *p = '\0'; + + /* Get parent directory: PREFIX */ -+ if ((p = strrchr(info.dli_fname, '/')) == NULL) -+ return NULL; ++ if ((p = strrchr(fname, '/')) == NULL) ++ goto err; + *p = '\0'; + + /* Path to the cert bundle; filename is from the ca-certificates recipe */ -+ if (snprintf(certfile, PATH_MAX, "%s/etc/ssl/certs/ca-certificates.crt", info.dli_fname) < 0) -+ return NULL; ++ if (snprintf(certfile, PATH_MAX, "%s/etc/ssl/certs/ca-certificates.crt", fname) < 0) ++ goto err; ++ ++ free(fname); + return strdup(certfile); ++err: ++ free(fname); ++ return NULL; +} +#else +#define _get_portable_X509_cert_file() NULL |