#1711 Coverity issue in ding-libs
Closed: Fixed None Opened 11 years ago by dpal.

13105: Dereference after null check ini_get_config_valueobj()

123    if ((mode < INI_GET_FIRST_VALUE) ||
124        (mode > INI_GET_NEXT_VALUE)) {
125        TRACE_ERROR_NUMBER("Invalid argument mode:", mode);
126        return EINVAL;
127    }
128
129    /* Do we have a name ? */
130    if (name == NULL) {
131        TRACE_ERROR_NUMBER("Name is NULL it will not be found.", EINVAL);
132        return EINVAL;
133    }
134
135    /* Empty section means look for the default one */
At conditional (1): "section == NULL" taking the true branch.
CID 13105: Dereference after null check (FORWARD_NULL)Comparing "section" to null implies that "section" might be null.
136    if (section == NULL) to_find = default_section;
137    else to_find = section;
138
139    TRACE_INFO_STRING("Getting Name:", name);
140    TRACE_INFO_STRING("In Section:", section);
141
142    /* Make sure we start over if this is the first value */
At conditional (2): "mode == 0" taking the false branch.
143    if (mode == INI_GET_FIRST_VALUE) ini_config_clean_state(ini_config);
144
145    /* Are we looking in the same section ? */
Passing null variable "section" to function "is_same_section", which dereferences it. [show details]
146    if (!is_same_section(ini_config, section)) {
147
148        /* This is a different section */

Fields changed

component: SSSD => INI Parser
description: 13105: Dereference after null check ini_get_config_valueobj()
=> 13105: Dereference after null check ini_get_config_valueobj()

{{{
123 if ((mode < INI_GET_FIRST_VALUE) ||
124 (mode > INI_GET_NEXT_VALUE)) {
125 TRACE_ERROR_NUMBER("Invalid argument mode:", mode);
126 return EINVAL;
127 }
128
129 / Do we have a name ? /
130 if (name == NULL) {
131 TRACE_ERROR_NUMBER("Name is NULL it will not be found.", EINVAL);
132 return EINVAL;
133 }
134
135 / Empty section means look for the default one /
At conditional (1): "section == NULL" taking the true branch.
CID 13105: Dereference after null check (FORWARD_NULL)Comparing "section" to null implies that "section" might be null.
136 if (section == NULL) to_find = default_section;
137 else to_find = section;
138
139 TRACE_INFO_STRING("Getting Name:", name);
140 TRACE_INFO_STRING("In Section:", section);
141
142 / Make sure we start over if this is the first value /
At conditional (2): "mode == 0" taking the false branch.
143 if (mode == INI_GET_FIRST_VALUE) ini_config_clean_state(ini_config);
144
145 / Are we looking in the same section ? /
Passing null variable "section" to function "is_same_section", which dereferences it. [show details]
146 if (!is_same_section(ini_config, section)) {
147
148 / This is a different section /

}}}
patch: 0 => 1

Fields changed

component: SSSD => INI Parser
description: 13105: Dereference after null check ini_get_config_valueobj()
=> 13105: Dereference after null check ini_get_config_valueobj()

{{{
123 if ((mode < INI_GET_FIRST_VALUE) ||
124 (mode > INI_GET_NEXT_VALUE)) {
125 TRACE_ERROR_NUMBER("Invalid argument mode:", mode);
126 return EINVAL;
127 }
128
129 / Do we have a name ? /
130 if (name == NULL) {
131 TRACE_ERROR_NUMBER("Name is NULL it will not be found.", EINVAL);
132 return EINVAL;
133 }
134
135 / Empty section means look for the default one /
At conditional (1): "section == NULL" taking the true branch.
CID 13105: Dereference after null check (FORWARD_NULL)Comparing "section" to null implies that "section" might be null.
136 if (section == NULL) to_find = default_section;
137 else to_find = section;
138
139 TRACE_INFO_STRING("Getting Name:", name);
140 TRACE_INFO_STRING("In Section:", section);
141
142 / Make sure we start over if this is the first value /
At conditional (2): "mode == 0" taking the false branch.
143 if (mode == INI_GET_FIRST_VALUE) ini_config_clean_state(ini_config);
144
145 / Are we looking in the same section ? /
Passing null variable "section" to function "is_same_section", which dereferences it. [show details]
146 if (!is_same_section(ini_config, section)) {
147
148 / This is a different section /

}}}
patch: 0 => 1

Fields changed

component: SSSD => INI Parser
description: 13105: Dereference after null check ini_get_config_valueobj()
=> 13105: Dereference after null check ini_get_config_valueobj()

{{{
123 if ((mode < INI_GET_FIRST_VALUE) ||
124 (mode > INI_GET_NEXT_VALUE)) {
125 TRACE_ERROR_NUMBER("Invalid argument mode:", mode);
126 return EINVAL;
127 }
128
129 / Do we have a name ? /
130 if (name == NULL) {
131 TRACE_ERROR_NUMBER("Name is NULL it will not be found.", EINVAL);
132 return EINVAL;
133 }
134
135 / Empty section means look for the default one /
At conditional (1): "section == NULL" taking the true branch.
CID 13105: Dereference after null check (FORWARD_NULL)Comparing "section" to null implies that "section" might be null.
136 if (section == NULL) to_find = default_section;
137 else to_find = section;
138
139 TRACE_INFO_STRING("Getting Name:", name);
140 TRACE_INFO_STRING("In Section:", section);
141
142 / Make sure we start over if this is the first value /
At conditional (2): "mode == 0" taking the false branch.
143 if (mode == INI_GET_FIRST_VALUE) ini_config_clean_state(ini_config);
144
145 / Are we looking in the same section ? /
Passing null variable "section" to function "is_same_section", which dereferences it. [show details]
146 if (!is_same_section(ini_config, section)) {
147
148 / This is a different section /

}}}
patch: 0 => 1

Patch has been pushed.

resolution: => fixed
status: new => closed

Patch has been pushed.

resolution: => fixed
status: new => closed

Patch has been pushed.

resolution: => fixed
status: new => closed

fixed in 89243948c4f0499e70ca5bdbad62f03fd3cfb6a4

selected: =>

fixed in 89243948c4f0499e70ca5bdbad62f03fd3cfb6a4

selected: =>

fixed in 89243948c4f0499e70ca5bdbad62f03fd3cfb6a4

selected: =>

Metadata Update from @dpal:
- Issue set to the milestone: Tools 1.0

7 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2753

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata