On (15/04/16 14:41), Michal Židek wrote:
On 03/16/2016 02:04 PM, Michal Židek wrote:
> Hi,
>
> these three patches add infrastructure for this libini feature
>
https://fedorahosted.org/sssd/wiki/DesignDocs/libini-config-file-checks
>
> I did not add the patch for ini_allowed_sections validator. Will
> add that validator when these patches are in master.
>
> I also did not bump the version number for now. Will do this
> before release.
>
> Any comments are welcome.
>
> Thanks
>
> Michal
>
Found some small issues in the patches so I
updated them and added ini_allowed_sections
validator to the patches.
Michal
From 675fe7aef88e2cfe4909c9c0b34e5f498233987b Mon Sep 17 00:00:00
2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek(a)redhat.com>
Date: Wed, 3 Feb 2016 18:51:49 +0100
Subject: [PATCH 1/4] ini: Add infrastructure for validators
Ticket:
https://fedorahosted.org/sssd/ticket/133
I found few warnigs reported by static analysers/mostly clang.
They might be related to compile time warnings gcc-6.0
ini/ini_configobj.c: In function ‘ini_allowed_sections’:
ini/ini_configobj.c:1312:5: warning: ‘allowed_sections_re’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
free(allowed_sections_re);
^~~~~~~~~~~~~~~~~~~~~~~~~
ini/ini_configobj.c: In function ‘ini_allowed_options’:
ini/ini_configobj.c:1486:5: warning: ‘sections’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
ini_free_section_list(sections);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could you check wheter they are real issuses or false positives?
Meanwhile, I will continue with review
@see also attached diff with coding style issues.
Error: FORWARD_NULL (CWE-476): [#def1]
ding-libs-0.5.0/ini/ini_configobj.c:1122: var_deref_model: Passing "NULL" to
"regexec", which dereferences it.
# 1120|
# 1121| for (int i = 0; i < num_sec_re; i++) {
# 1122|-> ret = regexec(&allowed_sections_re[i], tested_section, 0, NULL,
0);
# 1123| if (ret == 0) {
# 1124| return 1;
Error: CLANG_WARNING: [#def2]
ding-libs-0.5.0/ini/ini_configobj.c:1213:24: warning: Call to 'calloc' has an
allocation size of 0 bytes
# allowed_sections = calloc(num_sec, sizeof(char*));
# ^ ~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1145:5: note: 'num_sec' initialized to 0
# size_t num_sec = 0;
# ^~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:9: note: Assuming 'attributes' is not
equal to null
# if (attributes == NULL) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:5: note: Taking false branch
# if (attributes == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is <
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1167:9: note: Taking false branch
# if (strcmp("section", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1171:9: note: Taking true branch
# if (strcmp("section_re", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is >=
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is false. Execution
continues on line 1176
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:9: note: Left side of '&&' is
true
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:5: note: Taking false branch
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1191:9: note: Assuming 'ret' is 0
# if (ret) {
# ^~~
ding-libs-0.5.0/ini/ini_configobj.c:1191:5: note: Taking false branch
# if (ret) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1195:9: note: Assuming 'vo' is null
# if (vo) {
# ^~
ding-libs-0.5.0/ini/ini_configobj.c:1195:5: note: Taking false branch
# if (vo) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1213:24: note: Call to 'calloc' has an
allocation size of 0 bytes
# allowed_sections = calloc(num_sec, sizeof(char*));
# ^ ~~~~~~~
# 1211| /* Create arrays for section_re regexes and section name
# 1212| * strings. */
# 1213|-> allowed_sections = calloc(num_sec, sizeof(char*));
# 1214| if (allowed_sections == NULL) {
# 1215| ret = ENOMEM;
Error: CLANG_WARNING: [#def3]
ding-libs-0.5.0/ini/ini_configobj.c:1219:27: warning: Call to 'calloc' has an
allocation size of 0 bytes
# allowed_sections_re = calloc(num_sec_re, sizeof(regex_t));
# ^ ~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1146:5: note: 'num_sec_re' initialized to 0
# size_t num_sec_re = 0;
# ^~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:9: note: Assuming 'attributes' is not
equal to null
# if (attributes == NULL) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:5: note: Taking false branch
# if (attributes == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is <
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1167:9: note: Taking true branch
# if (strcmp("section", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1171:9: note: Taking false branch
# if (strcmp("section_re", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is >=
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is false. Execution
continues on line 1176
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:22: note: Left side of '&&' is
false
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1191:9: note: Assuming 'ret' is 0
# if (ret) {
# ^~~
ding-libs-0.5.0/ini/ini_configobj.c:1191:5: note: Taking false branch
# if (ret) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1195:9: note: Assuming 'vo' is null
# if (vo) {
# ^~
ding-libs-0.5.0/ini/ini_configobj.c:1195:5: note: Taking false branch
# if (vo) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1214:9: note: Assuming 'allowed_sections' is
not equal to null
# if (allowed_sections == NULL) {
# ^~~~~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1214:5: note: Taking false branch
# if (allowed_sections == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1219:27: note: Call to 'calloc' has an
allocation size of 0 bytes
# allowed_sections_re = calloc(num_sec_re, sizeof(regex_t));
# ^ ~~~~~~~~~~
# 1217| }
# 1218|
# 1219|-> allowed_sections_re = calloc(num_sec_re, sizeof(regex_t));
# 1220| if (allowed_sections_re == NULL) {
# 1221| ret = ENOMEM;
Error: CLANG_WARNING: [#def4]
ding-libs-0.5.0/ini/ini_configobj.c:1306:14: warning: Array access (from variable
'allowed_sections') results in a null pointer dereference
# free(allowed_sections[i]);
# ^~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1139:5: note: 'allowed_sections' initialized
to a null pointer value
# char **allowed_sections = NULL;
# ^~~~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:9: note: Assuming 'attributes' is not
equal to null
# if (attributes == NULL) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:5: note: Taking false branch
# if (attributes == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is <
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1167:9: note: Taking true branch
# if (strcmp("section", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1171:9: note: Taking false branch
# if (strcmp("section_re", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is >=
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is false. Execution
continues on line 1176
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:22: note: Left side of '&&' is
false
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1191:9: note: Assuming 'ret' is not equal to
0
# if (ret) {
# ^~~
ding-libs-0.5.0/ini/ini_configobj.c:1191:5: note: Taking true branch
# if (ret) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1192:9: note: Control jumps to line 1305
# goto done;
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1305:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_sec; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1306:14: note: Array access (from variable
'allowed_sections') results in a null pointer dereference
# free(allowed_sections[i]);
# ^~~~~~~~~~~~~~~~
# 1304| done:
# 1305| for (int i = 0; i < num_sec; i++) {
# 1306|-> free(allowed_sections[i]);
# 1307| }
# 1308| free(allowed_sections);
Error: CLANG_WARNING: [#def5]
ding-libs-0.5.0/ini/ini_configobj.c:1310:9: warning: Function call argument is an
uninitialized value
# regfree(&allowed_sections_re[i]);
# ^ ~~~~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:9: note: Assuming 'attributes' is not
equal to null
# if (attributes == NULL) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:5: note: Taking false branch
# if (attributes == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is <
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1167:9: note: Taking false branch
# if (strcmp("section", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1171:9: note: Taking true branch
# if (strcmp("section_re", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is >=
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is false. Execution
continues on line 1176
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:9: note: Left side of '&&' is
true
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:5: note: Taking false branch
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1191:9: note: Assuming 'ret' is not equal to
0
# if (ret) {
# ^~~
ding-libs-0.5.0/ini/ini_configobj.c:1191:5: note: Taking true branch
# if (ret) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1192:9: note: Control jumps to line 1305
# goto done;
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1305:5: note: Loop condition is false. Execution
continues on line 1308
# for (int i = 0; i < num_sec; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1309:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_sec_re; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1310:9: note: Function call argument is an
uninitialized value
# regfree(&allowed_sections_re[i]);
# ^ ~~~~~~~~~~~~~~~~~~~~~~~
# 1308| free(allowed_sections);
# 1309| for (int i = 0; i < num_sec_re; i++) {
# 1310|-> regfree(&allowed_sections_re[i]);
# 1311| }
# 1312| free(allowed_sections_re);
Error: UNINIT (CWE-457): [#def6]
ding-libs-0.5.0/ini/ini_configobj.c:1147: var_decl: Declaring variable
"allowed_sections_re" without initializer.
ding-libs-0.5.0/ini/ini_configobj.c:1312: uninit_use_in_call: Using uninitialized value
"allowed_sections_re" when calling "free".
# 1310| regfree(&allowed_sections_re[i]);
# 1311| }
# 1312|-> free(allowed_sections_re);
# 1313| ini_free_section_list(cfg_sections);
# 1314| free(regex_str);
Error: COMPILER_WARNING: [#def7]
ding-libs-0.5.0/ini/ini_configobj.c: scope_hint: In function
'ini_allowed_sections'
ding-libs-0.5.0/ini/ini_configobj.c:1312:5: warning: 'allowed_sections_re' may be
used uninitialized in this function [-Wmaybe-uninitialized]
# free(allowed_sections_re);
# ^
# 1310| regfree(&allowed_sections_re[i]);
# 1311| }
# 1312|-> free(allowed_sections_re);
# 1313| ini_free_section_list(cfg_sections);
# 1314| free(regex_str);
Error: CLANG_WARNING: [#def8]
ding-libs-0.5.0/ini/ini_configobj.c:1312:5: warning: Function call argument is an
uninitialized value
# free(allowed_sections_re);
# ^ ~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1147:5: note: 'allowed_sections_re' declared
without an initial value
# regex_t *allowed_sections_re;
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:9: note: Assuming 'attributes' is not
equal to null
# if (attributes == NULL) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1161:5: note: Taking false branch
# if (attributes == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1166:21: note: Assuming 'i' is >=
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1166:5: note: Loop condition is false. Execution
continues on line 1176
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:9: note: Left side of '&&' is
true
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1176:5: note: Taking true branch
# if (num_sec == 0 && num_sec_re == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1181:9: note: Control jumps to line 1305
# goto done;
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1305:5: note: Loop condition is false. Execution
continues on line 1308
# for (int i = 0; i < num_sec; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1309:5: note: Loop condition is false. Execution
continues on line 1312
# for (int i = 0; i < num_sec_re; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1312:5: note: Function call argument is an
uninitialized value
# free(allowed_sections_re);
# ^ ~~~~~~~~~~~~~~~~~~~
# 1310| regfree(&allowed_sections_re[i]);
# 1311| }
# 1312|-> free(allowed_sections_re);
# 1313| ini_free_section_list(cfg_sections);
# 1314| free(regex_str);
Error: RESOURCE_LEAK (CWE-772): [#def9]
ding-libs-0.5.0/ini/ini_configobj.c:1166: start: Starting defect path here.
ding-libs-0.5.0/ini/ini_configobj.c:1263: alloc_fn: Storage is returned from allocation
function "malloc".
ding-libs-0.5.0/ini/ini_configobj.c:1263: var_assign: Assigning: "err_str" =
storage returned from "malloc(buf_size)".
ding-libs-0.5.0/ini/ini_configobj.c:1269: noescape: Resource "err_str" is not
freed or pointed-to in "regerror".
ding-libs-0.5.0/ini/ini_configobj.c:1270: noescape: Resource "err_str" is not
freed or pointed-to in "ini_errobj_add_msg".
ding-libs-0.5.0/ini/ini_configobj.c:1316: leaked_storage: Variable "err_str"
going out of scope leaks the storage it points to.
# 1314| free(regex_str);
# 1315|
# 1316|-> return ret;
# 1317| }
# 1318|
Error: CLANG_WARNING: [#def10]
ding-libs-0.5.0/ini/ini_configobj.c:1433:15: warning: Call to 'calloc' has an
allocation size of 0 bytes
# allowed = calloc(num_opts, sizeof(char *));
# ^ ~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1354:5: note: 'num_opts' initialized to 0
# int num_opts = 0;
# ^~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:9: note: Assuming 'ret' is equal to 0
# if (ret != 0) {
# ^~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:5: note: Taking false branch
# if (ret != 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1371:9: note: Assuming 'vo' is not equal to
null
# if (vo == NULL) {
# ^~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1371:5: note: Taking false branch
# if (vo == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1380:9: note: Assuming 'section_regex' is not
equal to null
# if (section_regex == NULL || section_regex[0] == '\0') {
# ^~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1380:9: note: Left side of '||' is false
ding-libs-0.5.0/ini/ini_configobj.c:1380:5: note: Taking false branch
# if (section_regex == NULL || section_regex[0] == '\0') {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1392:9: note: Assuming 'reg_err' is 0
# if (reg_err) {
# ^~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1392:5: note: Taking false branch
# if (reg_err) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1409:9: note: Assuming 'ret' is equal to 0
# if (ret != EOK) {
# ^~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1409:5: note: Taking false branch
# if (ret != EOK) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1419:9: note: Assuming 'attributes' is not
equal to null
# if (attributes == NULL) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1419:5: note: Taking false branch
# if (attributes == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1424:21: note: Assuming 'i' is >=
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1424:5: note: Loop condition is false. Execution
continues on line 1430
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1433:15: note: Call to 'calloc' has an
allocation size of 0 bytes
# allowed = calloc(num_opts, sizeof(char *));
# ^ ~~~~~~~~
# 1431| attributes = NULL;
# 1432|
# 1433|-> allowed = calloc(num_opts, sizeof(char *));
# 1434| if (allowed == NULL) {
# 1435| ret = ENOMEM;
Error: CLANG_WARNING: [#def11]
ding-libs-0.5.0/ini/ini_configobj.c:1483:14: warning: Array access (from variable
'allowed') results in a null pointer dereference
# free(allowed[i]);
# ^~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:9: note: Assuming 'ret' is equal to 0
# if (ret != 0) {
# ^~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:5: note: Taking false branch
# if (ret != 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1371:9: note: Assuming 'vo' is not equal to
null
# if (vo == NULL) {
# ^~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1371:5: note: Taking false branch
# if (vo == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1380:9: note: Assuming 'section_regex' is not
equal to null
# if (section_regex == NULL || section_regex[0] == '\0') {
# ^~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1380:9: note: Left side of '||' is false
ding-libs-0.5.0/ini/ini_configobj.c:1380:5: note: Taking false branch
# if (section_regex == NULL || section_regex[0] == '\0') {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1392:9: note: Assuming 'reg_err' is 0
# if (reg_err) {
# ^~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1392:5: note: Taking false branch
# if (reg_err) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1409:9: note: Assuming 'ret' is equal to 0
# if (ret != EOK) {
# ^~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1409:5: note: Taking false branch
# if (ret != EOK) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1419:9: note: Assuming 'attributes' is not
equal to null
# if (attributes == NULL) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1419:5: note: Taking false branch
# if (attributes == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1424:21: note: Assuming 'i' is <
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1424:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1425:9: note: Taking true branch
# if (strcmp("option", attributes[i]) == 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1424:21: note: Assuming 'i' is >=
'num_attributes'
# for (int i = 0; i < num_attributes; i++) {
# ^~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1424:5: note: Loop condition is false. Execution
continues on line 1430
# for (int i = 0; i < num_attributes; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1433:5: note: Value assigned to 'allowed'
# allowed = calloc(num_opts, sizeof(char *));
# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1434:9: note: Assuming 'allowed' is equal to
null
# if (allowed == NULL) {
# ^~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1434:5: note: Taking true branch
# if (allowed == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1436:9: note: Control jumps to line 1482
# goto done;
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1482:5: note: Loop condition is true. Entering loop
body
# for (int i = 0; i < num_opts; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1483:14: note: Array access (from variable
'allowed') results in a null pointer dereference
# free(allowed[i]);
# ^~~~~~~
# 1481| done:
# 1482| for (int i = 0; i < num_opts; i++) {
# 1483|-> free(allowed[i]);
# 1484| }
# 1485| free(allowed);
Error: COMPILER_WARNING: [#def12]
ding-libs-0.5.0/ini/ini_configobj.c: scope_hint: In function
'ini_allowed_options'
ding-libs-0.5.0/ini/ini_configobj.c:1486:5: warning: 'sections' may be used
uninitialized in this function [-Wmaybe-uninitialized]
# ini_free_section_list(sections);
# ^
# 1484| }
# 1485| free(allowed);
# 1486|-> ini_free_section_list(sections);
# 1487| free(section_regex);
# 1488| ini_free_attribute_list(attributes);
Error: CLANG_WARNING: [#def13]
ding-libs-0.5.0/ini/ini_configobj.c:1486:5: warning: Function call argument is an
uninitialized value
# ini_free_section_list(sections);
# ^ ~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1351:5: note: 'sections' declared without an
initial value
# char **sections;
# ^~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:9: note: Assuming 'ret' is equal to 0
# if (ret != 0) {
# ^~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:5: note: Taking false branch
# if (ret != 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1371:9: note: Assuming 'vo' is not equal to
null
# if (vo == NULL) {
# ^~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1371:5: note: Taking false branch
# if (vo == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1380:9: note: Assuming 'section_regex' is not
equal to null
# if (section_regex == NULL || section_regex[0] == '\0') {
# ^~~~~~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1380:9: note: Left side of '||' is false
ding-libs-0.5.0/ini/ini_configobj.c:1380:5: note: Taking false branch
# if (section_regex == NULL || section_regex[0] == '\0') {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1392:9: note: Assuming 'reg_err' is not equal
to 0
# if (reg_err) {
# ^~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1392:5: note: Taking true branch
# if (reg_err) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1395:13: note: Assuming 'err_str' is equal to
null
# if (err_str == NULL) {
# ^~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1395:9: note: Taking true branch
# if (err_str == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1397:13: note: Control jumps to line 1482
# goto done;
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1482:5: note: Loop condition is false. Execution
continues on line 1485
# for (int i = 0; i < num_opts; i++) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1486:5: note: Function call argument is an
uninitialized value
# ini_free_section_list(sections);
# ^ ~~~~~~~~
# 1484| }
# 1485| free(allowed);
# 1486|-> ini_free_section_list(sections);
# 1487| free(section_regex);
# 1488| ini_free_attribute_list(attributes);
Error: CLANG_WARNING: [#def14]
ding-libs-0.5.0/ini/ini_configobj.c:1488:5: warning: Function call argument is an
uninitialized value
# ini_free_attribute_list(attributes);
# ^ ~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1352:5: note: 'attributes' declared without an
initial value
# char **attributes;
# ^~~~~~~~~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:9: note: Assuming 'ret' is equal to 0
# if (ret != 0) {
# ^~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1367:5: note: Taking false branch
# if (ret != 0) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1371:9: note: Assuming 'vo' is not equal to
null
# if (vo == NULL) {
# ^~~~~~~~~~
ding-libs-0.5.0/ini/ini_configobj.c:1371:5: note: Taking false branch
# if (vo == NULL) {
# ^
ding-libs-0.5.0/ini/ini_configobj.c:1380:9: note: Assuming 'section_regex' is not
equal to null
# if (section_regex == NULL || section_regex[0] == '\0') {
# ^~~~~~~~~~~~~~~~~~~~~
ding
LS