Skip to content

Commit

Permalink
devel/gdcm: Fix build when with LibreSSL 3.8.2.
Browse files Browse the repository at this point in the history
gdcm uses the BUF_memdup() function which was removed from LibreSSL.
Attached patch adds a local copy when built with LibreSSL.

PR:		275568
Reported by:	zirias@
  • Loading branch information
Stephen Montgomery-Smith authored and Stephen Montgomery-Smith committed Dec 7, 2023
1 parent 12a8c31 commit 003fde6
Showing 1 changed file with 25 additions and 0 deletions.
@@ -0,0 +1,25 @@
--- Source/Common/gdcmOpenSSLCryptographicMessageSyntax.cxx.orig 2023-12-04 07:33:11 UTC
+++ Source/Common/gdcmOpenSSLCryptographicMessageSyntax.cxx
@@ -24,6 +24,22 @@
#include <openssl/err.h>
#include <openssl/rand.h>

+#if LIBRESSL_VERSION_NUMBER >= 0x3080200fL
+// implementation copied from LibreSSL before removal in 3.8.2
+static void *BUF_memdup(const void *data, size_t siz)
+{
+ void *ret = NULL;
+ if (data != NULL)
+ {
+ if ((ret = malloc(siz)) == NULL)
+ ERR_PUT_error(ERR_LIB_BUF,(0xfff),ERR_R_MALLOC_FAILURE,__FILE__,__LINE__);
+ else
+ (void) memcpy(ret, data, siz);
+ }
+ return ret;
+}
+#endif
+
namespace gdcm
{

0 comments on commit 003fde6

Please sign in to comment.