gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnurl] 146/222: ldap: fix OOM error on missing query string


From: gnunet
Subject: [gnurl] 146/222: ldap: fix OOM error on missing query string
Date: Thu, 07 Nov 2019 00:10:42 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit 8bb3a95ce1577e2c8282e7d1c2830bde87cf5c3b
Author: Nicolas <address@hidden>
AuthorDate: Fri Oct 4 22:49:43 2019 -0300

    ldap: fix OOM error on missing query string
    
    - Allow missing queries, don't return NO_MEMORY error in such a case.
    
    It is acceptable for there to be no specified query string, for example:
    
    curl ldap://ldap.forumsys.com
    
    A regression bug in 1b443a7 caused this issue.
    
    This is a partial fix for #4261.
    
    Bug: https://github.com/curl/curl/issues/4261#issuecomment-525543077
    Reported-by: address@hidden
    Analyzed-by: Samuel Surtees
    
    Closes https://github.com/curl/curl/pull/4467
---
 lib/ldap.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/ldap.c b/lib/ldap.c
index d7d90fea7..af3d61c57 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -844,10 +844,10 @@ static bool split_str(char *str, char ***out, size_t 
*count)
 static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
 {
   int rc = LDAP_SUCCESS;
-  char *path;
-  char *query;
   char *p;
-  char *q;
+  char *path;
+  char *q = NULL;
+  char *query = NULL;
   size_t i;
 
   if(!conn->data ||
@@ -865,11 +865,13 @@ static int _ldap_url_parse2(const struct connectdata 
*conn, LDAPURLDesc *ludp)
   if(!path)
     return LDAP_NO_MEMORY;
 
-  /* Duplicate the query */
-  q = query = strdup(conn->data->state.up.query);
-  if(!query) {
-    free(path);
-    return LDAP_NO_MEMORY;
+  /* Duplicate the query if present */
+  if(conn->data->state.up.query) {
+    q = query = strdup(conn->data->state.up.query);
+    if(!query) {
+      free(path);
+      return LDAP_NO_MEMORY;
+    }
   }
 
   /* Parse the DN (Distinguished Name) */

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]