andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From b7437122220518261d34b84aae200140ef1f7c4e Mon Sep 17 00:00:00 2001
From: Stanislav Zidek <szidek@redhat.com>
Date: Wed, 21 Oct 2015 17:58:31 -0700
Subject: [PATCH 369/370] Ticket #48289 - 389-ds-base: ldclt-bin killed by
 SIGSEGV

Description: If NULL source string was passed to parseFilter, it caused
NULL dereference.

https://fedorahosted.org/389/ticket/48289

Reviewed by nhosoi@redhat.com.

(cherry picked from commit 5b33c781d2568c930a0856f0a42c1e1d53e3358f)
(cherry picked from commit 8cd610a944daf72a41e5b35065f8b363f8154f28)
(cherry picked from commit 49d0ef667441e009af071fd0f4d48f31f3514063)
---
 ldap/servers/slapd/tools/ldclt/ldclt.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.c b/ldap/servers/slapd/tools/ldclt/ldclt.c
index 7d22c2d..41ef2c0 100644
--- a/ldap/servers/slapd/tools/ldclt/ldclt.c
+++ b/ldap/servers/slapd/tools/ldclt/ldclt.c
@@ -1213,6 +1213,11 @@ parseFilter (
 {
   int	 i, j;
 
+  if (!src) {
+    printf ("Error: NULL source string is passed.\n");
+    return (-1);
+  }
+
   for (i=0 ; (i<strlen(src)) && (src[i]!='X') ; i++);
   *head = (char *)malloc(i+1);
   if (*head == NULL)
-- 
2.4.3