76 lines
2.3 KiB
Diff
76 lines
2.3 KiB
Diff
From 90fbe4af03e9063cb29a1d026d18fefd6c767c7d Mon Sep 17 00:00:00 2001
|
|
From: Nicolas Williams <nico@twosigma.com>
|
|
Date: Thu, 21 May 2015 14:05:31 -0500
|
|
Subject: [PATCH 1/4] CVE-2022-42898 source4/heimdal: Add bswap64()
|
|
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15203
|
|
|
|
[jsutton@samba.org backported from Heimdal commit
|
|
0271b171e5331f0f562319b887f5f0b058ecc9b4; removed changes to
|
|
cf/roken-frag.m4 that we don't have]
|
|
---
|
|
source4/heimdal/lib/roken/bswap.c | 17 +++++++++++++++++
|
|
source4/heimdal/lib/roken/roken.h.in | 5 +++++
|
|
source4/heimdal/lib/roken/version-script.map | 1 +
|
|
3 files changed, 23 insertions(+)
|
|
|
|
diff --git a/source4/heimdal/lib/roken/bswap.c b/source4/heimdal/lib/roken/bswap.c
|
|
index 7f8c1c22b1b..b0c4248da11 100644
|
|
--- a/source4/heimdal/lib/roken/bswap.c
|
|
+++ b/source4/heimdal/lib/roken/bswap.c
|
|
@@ -34,6 +34,23 @@
|
|
#include <config.h>
|
|
#include "roken.h"
|
|
|
|
+#ifndef HAVE_BSWAP64
|
|
+
|
|
+ROKEN_LIB_FUNCTION uint64_t ROKEN_LIB_CALL
|
|
+bswap64 (uint64_t val)
|
|
+{
|
|
+ return
|
|
+ (val & 0xffULL) << 56 |
|
|
+ (val & 0xff00ULL) << 40 |
|
|
+ (val & 0xff0000ULL) << 24 |
|
|
+ (val & 0xff000000ULL) << 8 |
|
|
+ (val & 0xff00000000ULL) >> 8 |
|
|
+ (val & 0xff0000000000ULL) >> 24 |
|
|
+ (val & 0xff000000000000ULL) >> 40 |
|
|
+ (val & 0xff00000000000000ULL) >> 56 ;
|
|
+}
|
|
+#endif
|
|
+
|
|
#ifndef HAVE_BSWAP32
|
|
|
|
ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
|
|
diff --git a/source4/heimdal/lib/roken/roken.h.in b/source4/heimdal/lib/roken/roken.h.in
|
|
index a6299aee8e5..13a5d943ba2 100644
|
|
--- a/source4/heimdal/lib/roken/roken.h.in
|
|
+++ b/source4/heimdal/lib/roken/roken.h.in
|
|
@@ -696,6 +696,11 @@ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pidfile (const char*);
|
|
#endif
|
|
#endif
|
|
|
|
+#ifndef HAVE_BSWAP64
|
|
+#define bswap64 rk_bswap64
|
|
+ROKEN_LIB_FUNCTION uint64_t ROKEN_LIB_CALL bswap64(uint64_t);
|
|
+#endif
|
|
+
|
|
#ifndef HAVE_BSWAP32
|
|
#define bswap32 rk_bswap32
|
|
ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL bswap32(unsigned int);
|
|
diff --git a/source4/heimdal/lib/roken/version-script.map b/source4/heimdal/lib/roken/version-script.map
|
|
index 9229a373cd7..34b42a3639f 100644
|
|
--- a/source4/heimdal/lib/roken/version-script.map
|
|
+++ b/source4/heimdal/lib/roken/version-script.map
|
|
@@ -38,6 +38,7 @@ HEIMDAL_ROKEN_1.0 {
|
|
rk_asprintf;
|
|
rk_bswap16;
|
|
rk_bswap32;
|
|
+ rk_bswap64;
|
|
rk_cgetent;
|
|
rk_cgetstr;
|
|
rk_cloexec;
|
|
--
|
|
2.35.0
|
|
|