From 88e72423c74848837d01760f53b776d0c6b33064 Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Aug 14 2015 16:54:33 +0000 Subject: Ticket 48249: sync_repl uuid may be invalid Bug Description: uuid is computed from nsuniqueid of the entry. If the computed uuid contains NULL char, slapi_ch_smprintf("%s") will stop on the it, leaving the rest of the buffer with the value that was on the heap at that time Fix Description: use malloc/memcpy instead of slapi_ch_smprintf https://fedorahosted.org/389/ticket/48249 Reviewed by: Noriko Hosoi (thank you !!) Platforms tested: F22 Flag Day: no Doc impact: no --- diff --git a/ldap/servers/plugins/sync/sync_util.c b/ldap/servers/plugins/sync/sync_util.c index 00dc182..1dcff91 100644 --- a/ldap/servers/plugins/sync/sync_util.c +++ b/ldap/servers/plugins/sync/sync_util.c @@ -107,7 +107,8 @@ sync_nsuniqueid2uuid(const char *nsuniqueid) u[16] = '\0'; - uuid = slapi_ch_smprintf("%s",(char *)u); + uuid = slapi_ch_malloc(sizeof(u)); + memcpy(uuid, u, sizeof(u)); return(uuid); }