83ce07
From bd566957f85c889f13cd24f903c91c16c955acbd Mon Sep 17 00:00:00 2001
83ce07
From: Thierry Bordaz <tbordaz@redhat.com>
83ce07
Date: Thu, 18 Aug 2022 13:37:47 +0200
83ce07
Subject: [PATCH 2/3] Issue 5418 - Sync_repl may crash while managing invalid
83ce07
 cookie (#5420)
83ce07
83ce07
Bug description:
83ce07
        If the servers receives an invalid cookie without separator '#',
83ce07
        it parses it into an empty cookie (Sync_Cookie) instead of a NULL
83ce07
        cookie (failure).
83ce07
        Later it sigsegv when using the empty cookie.
83ce07
83ce07
Fix description:
83ce07
        If the parsing fails return NULL
83ce07
83ce07
relates: #5418
83ce07
83ce07
Reviewed by: Viktor Ashirov, Mark Reynolds, William Brown, Simon Pichugin (thanks !)
83ce07
---
83ce07
 ldap/servers/plugins/sync/sync_util.c | 2 ++
83ce07
 1 file changed, 2 insertions(+)
83ce07
83ce07
diff --git a/ldap/servers/plugins/sync/sync_util.c b/ldap/servers/plugins/sync/sync_util.c
83ce07
index 8c2c42d0d..73f003921 100644
83ce07
--- a/ldap/servers/plugins/sync/sync_util.c
83ce07
+++ b/ldap/servers/plugins/sync/sync_util.c
83ce07
@@ -546,6 +546,8 @@ sync_cookie_parse(char *cookie)
83ce07
         } else {
83ce07
             goto error_return;
83ce07
         }
83ce07
+    } else {
83ce07
+            goto error_return;
83ce07
     }
83ce07
     return (sc);
83ce07
 error_return:
83ce07
-- 
83ce07
2.37.3
83ce07