andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0044-Ticket-48249-sync_repl-uuid-may-be-invalid.patch

a2f18f
From 3598e701b5362633daa40380088d6ba9c8e2d103 Mon Sep 17 00:00:00 2001
a2f18f
From: Thierry Bordaz <tbordaz@redhat.com>
a2f18f
Date: Fri, 14 Aug 2015 12:32:31 +0200
a2f18f
Subject: [PATCH 44/45] Ticket 48249: sync_repl uuid may be invalid
a2f18f
a2f18f
Bug Description:
a2f18f
	uuid is computed from nsuniqueid of the entry.
a2f18f
	If the computed uuid contains NULL char, slapi_ch_smprintf("%s")
a2f18f
	will stop on the it, leaving the rest of the buffer with the value
a2f18f
	that was on the heap at that time
a2f18f
a2f18f
Fix Description:
a2f18f
	use malloc/memcpy instead of slapi_ch_smprintf
a2f18f
a2f18f
https://fedorahosted.org/389/ticket/48249
a2f18f
a2f18f
Reviewed by: Noriko Hosoi (thank you !!)
a2f18f
a2f18f
Platforms tested: F22
a2f18f
a2f18f
Flag Day: no
a2f18f
a2f18f
Doc impact: no
a2f18f
a2f18f
(cherry picked from commit a80fe155cb302e0ef10e14cb238c88698b5995a2)
a2f18f
---
a2f18f
 ldap/servers/plugins/sync/sync_util.c | 3 ++-
a2f18f
 1 file changed, 2 insertions(+), 1 deletion(-)
a2f18f
a2f18f
diff --git a/ldap/servers/plugins/sync/sync_util.c b/ldap/servers/plugins/sync/sync_util.c
a2f18f
index 00dc182..1dcff91 100644
a2f18f
--- a/ldap/servers/plugins/sync/sync_util.c
a2f18f
+++ b/ldap/servers/plugins/sync/sync_util.c
a2f18f
@@ -107,7 +107,8 @@ sync_nsuniqueid2uuid(const char *nsuniqueid)
a2f18f
 
a2f18f
 	u[16] = '\0';
a2f18f
 
a2f18f
-	uuid = slapi_ch_smprintf("%s",(char *)u);
a2f18f
+	uuid = slapi_ch_malloc(sizeof(u));
a2f18f
+	memcpy(uuid, u, sizeof(u));
a2f18f
 
a2f18f
 	return(uuid);
a2f18f
 }
a2f18f
-- 
a2f18f
1.9.3
a2f18f