Bug 750624

Summary: Fix Coverity (11053) Explicit null dereferenced: slapi_dn_normalize_ext (slapd/dn.c)
Product: [Retired] 389 Reporter: Noriko Hosoi <nhosoi>
Component: Directory ServerAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED CURRENTRELEASE QA Contact: Ben Levenson <benl>
Severity: low Docs Contact:
Priority: low    
Version: 1.2.10CC: rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 781504 (view as bug list) Environment:
Last Closed: 2015-12-10 18:44:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 743970, 781504    
Attachments:
Description Flags
git patch file (master) nhosoi: review?, rmeggins: review+

Description Noriko Hosoi 2011-11-01 19:32:04 UTC
Description of problem:
If NULL string or size 0 string to slapi_dn_normalization_ext, NULL dereference would occur.

Comment 1 Noriko Hosoi 2011-11-01 22:52:29 UTC
Actually, there is no possibility to set '\0' to *d if "d == NULL" because the condition "rc > 0" never be fulfilled. (rc > 0 is set only when the input string contains '"' or '\'.) Thus, change the severity to minor.

Comment 2 Noriko Hosoi 2011-11-02 17:02:11 UTC
Created attachment 531390 [details]
git patch file (master)

Bug Description: Dereferencing null variable "d".
There is no possibility that (rc > 0) && (d == NULL), but it's
safe to check if d is not NULL before assigning '\0' to *d.

Fix Description: add checking if "d" is NULL or not before
assigning '\0' to *d.

Comment 3 Noriko Hosoi 2011-11-02 23:10:19 UTC
Reviewed by Rich (Thank you!!)

Pushed to master.

commit 54a3d99a96d84b42f680da43c7f638009c0f64d4
Author: Noriko Hosoi <nhosoi.redhat.com>
Date:   Tue Nov 1 16:05:12 2011 -0700

    Bug 750624 - Fix Coverity (11053) Explicit null dereferenced:
                 slapi_dn_normalize_ext (slapd/dn.c)

$ git merge 54a3d99a96d84b42f680da43c7f638009c0f64d4
Updating 6af5ece..54a3d99
Fast-forward
 ldap/servers/slapd/dn.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

$ git push
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 870 bytes, done.
Total 6 (delta 4), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   6af5ece..54a3d99  master -> master

Comment 4 Rich Megginson 2012-01-10 20:18:22 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/241