Browse Source

Bug 750625 - Fix Coverity (12195) Dereference after null check

https://bugzilla.redhat.com/show_bug.cgi?id=750625

slapd/dn.c (slapi_dn_normalize_ext)

Bug Description: Dereferencing null variable "dest_len".
Missed to check the NULL possibility of the argument "dest_len"
to return the normalized dn size.

Fix Description: Assinging 0 to "*dest_len" only when "dest_len"
is not NULL.
Noriko Hosoi 14 years ago
parent
commit
68abfd6d81
1 changed files with 3 additions and 1 deletions
  1. 3 1
      ldap/servers/slapd/dn.c

+ 3 - 1
ldap/servers/slapd/dn.c

@@ -1080,7 +1080,9 @@ bail:
                 *dest = NULL;
             }
         }
-        *dest_len = 0;
+        if (dest_len != NULL) {
+            *dest_len = 0;
+        }
     } else if (d && rc > 0) {
         /* We terminate the str with NULL only when we allocate the str */
         *d = '\0';