]> granicus.if.org Git - sudo/commitdiff
Fix free() of invalid pointer introduced in the commit that stripped
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 11 Jan 2016 23:44:05 +0000 (16:44 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 11 Jan 2016 23:44:05 +0000 (16:44 -0700)
whitespace between a '!' and the name in a sudoOption.

plugins/sudoers/ldap.c

index 1f547f557e15a1c1b4cd88f0fb99f1ba93ef7ffa..c1e12b52e9638565c8358304a4a6d865e563a40a 100644 (file)
@@ -1046,7 +1046,7 @@ static bool
 sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
 {
     struct berval **bv, **p;
-    char *cp, *var;
+    char *copy, *cp, *var;
     int op;
     bool rc = false;
     debug_decl(sudo_ldap_parse_options, SUDOERS_DEBUG_LDAP)
@@ -1057,7 +1057,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
 
     /* walk through options */
     for (p = bv; *p != NULL; p++) {
-       if ((var = strdup((*p)->bv_val)) == NULL) {
+       if ((copy = var = strdup((*p)->bv_val)) == NULL) {
            sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            goto done;
        }
@@ -1102,7 +1102,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
            /* case var Boolean True */
            set_default(var, NULL, true);
        }
-       free(var);
+       free(copy);
     }
     rc = true;