libeconf-0.7.4-3.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c: scope_hint: In function ‘join_same_entries’
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c:70:35: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup("")’
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c:34: included_from: Included from here.
#   68|   	  /* reset entry */
#   69|   	  free(ef->file_entry[i].value);
#   70|-> 	  ef->file_entry[i].value = strdup("");
#   71|   	} else {
#   72|   	  /* appending value */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c:118:53: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(post)’
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c: scope_hint: In function ‘join_same_entries’
#  116|               if (pre == NULL)
#  117|   	    {
#  118|-> 	      ef->file_entry[i].comment_after_value = strdup(post);
#  119|   	    } else {
#  120|   	      int ret = asprintf(&(ef->file_entry[i].comment_after_value),

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c: scope_hint: In function ‘read_file’
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c:507:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘strdup(buf)’
#  505|         bool found_delim = false;
#  506|         if (ef->python_style == false ||
#  507|-> 	  !isspace(*org_buf))
#  508|         {
#  509|           /* It is not a typical python style with indentation */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def4]
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c:531:24: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘strdup(buf)’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
#  529|             /* removing comments */
#  530|             for (size_t i = 0; i < strlen(comment); i++) {
#  531|-> 	    char *pt = strchr(org_buf, comment[i]);
#  532|   	    if (pt)
#  533|   	      *pt = '\0';

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
libeconf-0.7.4-build/libeconf-0.7.4/lib/getfilecontents.c:537:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘strdup(buf)’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
#  535|   	}
#  536|   	/* removing \n at the end of the line */
#  537|-> 	if( org_buf[strlen(org_buf)-1] == '\n' )
#  538|   	  org_buf[strlen(org_buf)-1] = 0;
#  539|   	retval = store(ef, current_group, name, org_buf, line,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
libeconf-0.7.4-build/libeconf-0.7.4/lib/keyfile.c: scope_hint: In function ‘setBoolValueNum’
libeconf-0.7.4-build/libeconf-0.7.4/lib/keyfile.c:267:31: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup("true")’
#  265|     if ((*value == '1' && strlen(tmp) == 1) || hash == YES || hash == TRUE) {
#  266|       free(kf->file_entry[num].value);
#  267|->     kf->file_entry[num].value = strdup("true");
#  268|     } else if ((*value == '0' && strlen(tmp) == 1) ||
#  269|                hash == NO || hash == FALSE) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
libeconf-0.7.4-build/libeconf-0.7.4/lib/keyfile.c:271:31: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup("false")’
#  269|                hash == NO || hash == FALSE) {
#  270|       free(kf->file_entry[num].value);
#  271|->     kf->file_entry[num].value = strdup("false");
#  272|     } else if (hash == KEY_FILE_NULL_VALUE_HASH || strlen(value) == 0) {
#  273|       free(kf->file_entry[num].value);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libeconf-0.7.4-build/libeconf-0.7.4/lib/keyfile.c:274:31: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup("_none_")’
libeconf-0.7.4-build/libeconf-0.7.4/lib/keyfile.c:25: included_from: Included from here.
libeconf-0.7.4-build/libeconf-0.7.4/lib/keyfile.c:269:36: note: in expansion of macro ‘FALSE’
libeconf-0.7.4-build/libeconf-0.7.4/lib/keyfile.c:272:22: note: in expansion of macro ‘KEY_FILE_NULL_VALUE_HASH’
#  272|     } else if (hash == KEY_FILE_NULL_VALUE_HASH || strlen(value) == 0) {
#  273|       free(kf->file_entry[num].value);
#  274|->     kf->file_entry[num].value = strdup(KEY_FILE_NULL_VALUE);
#  275|     } else { error = ECONF_WRONG_BOOLEAN_VALUE; }
#  276|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c: scope_hint: In function ‘econf_readConfigWithCallback’
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:348:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘**key_file.conf_dirs’
#  346|       (*key_file)->conf_dirs = calloc((*key_file)->conf_count +1, sizeof(char *));
#  347|       (*key_file)->conf_dirs[(*key_file)->conf_count] = NULL;
#  348|->     (*key_file)->conf_dirs[0] = strdup(".d");
#  349|     }
#  350|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:348:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(2, 8)’
#  346|       (*key_file)->conf_dirs = calloc((*key_file)->conf_count +1, sizeof(char *));
#  347|       (*key_file)->conf_dirs[(*key_file)->conf_count] = NULL;
#  348|->     (*key_file)->conf_dirs[0] = strdup(".d");
#  349|     }
#  350|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c: scope_hint: In function ‘econf_readDirsHistoryWithCallback’
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:434:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘parse_dirs’
#  432|      parse_dirs[count] = NULL;
#  433|      if (dist_conf_dir)
#  434|->      parse_dirs[0] = strdup(dist_conf_dir);
#  435|      else
#  436|        parse_dirs[0] = strdup("");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def12]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:436:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘parse_dirs’
#  434|        parse_dirs[0] = strdup(dist_conf_dir);
#  435|      else
#  436|->      parse_dirs[0] = strdup("");
#  437|      if (etc_conf_dir)
#  438|        parse_dirs[1] = strdup(etc_conf_dir);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def13]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c: scope_hint: In function ‘econf_readDirsHistory’
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:470:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘parse_dirs’
#  468|     parse_dirs[count] = NULL;
#  469|     if (dist_conf_dir)
#  470|->     parse_dirs[0] = strdup(dist_conf_dir);
#  471|     else
#  472|       parse_dirs[0] = strdup("");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:472:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘parse_dirs’
#  470|       parse_dirs[0] = strdup(dist_conf_dir);
#  471|     else
#  472|->     parse_dirs[0] = strdup("");
#  473|     if (etc_conf_dir)
#  474|       parse_dirs[1] = strdup(etc_conf_dir);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c: scope_hint: In function ‘econf_readDirsWithCallback’
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:507:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(3, 8)’
#  505|     (*result)->parse_dirs[(*result)->parse_dirs_count] = NULL;
#  506|     if (dist_conf_dir)
#  507|->     (*result)->parse_dirs[0] = strdup(dist_conf_dir);
#  508|     else
#  509|       (*result)->parse_dirs[0] = strdup("");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:509:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(3, 8)’
#  507|       (*result)->parse_dirs[0] = strdup(dist_conf_dir);
#  508|     else
#  509|->     (*result)->parse_dirs[0] = strdup("");
#  510|     if (etc_conf_dir)
#  511|       (*result)->parse_dirs[1] = strdup(etc_conf_dir);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def17]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c: scope_hint: In function ‘econf_readDirs’
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:538:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(3, 8)’
#  536|     (*result)->parse_dirs[(*result)->parse_dirs_count] = NULL;
#  537|     if (dist_conf_dir)
#  538|->     (*result)->parse_dirs[0] = strdup(dist_conf_dir);
#  539|     else
#  540|       (*result)->parse_dirs[0] = strdup("");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def18]
libeconf-0.7.4-build/libeconf-0.7.4/lib/libeconf.c:540:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(3, 8)’
#  538|       (*result)->parse_dirs[0] = strdup(dist_conf_dir);
#  539|     else
#  540|->     (*result)->parse_dirs[0] = strdup("");
#  541|     if (etc_conf_dir)
#  542|       (*result)->parse_dirs[1] = strdup(etc_conf_dir);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def19]
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c: scope_hint: In function ‘change_root_dir.part.0’
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c:130:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘tmp’ where non-null expected
<built-in>: note: argument 2 of ‘__builtin_strcat’ must be non-null
#  128|   
#  129|           strcpy(change_path, getenv("ECONFTOOL_ROOT"));
#  130|->         strcat(change_path, tmp);
#  131|   
#  132|           free(tmp);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c: scope_hint: In function ‘pr_key_file’
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c:226:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘groups’
#  224|   	    /* no groups defined; generating an root entry */
#  225|   	    groups = calloc(1, sizeof(char*));
#  226|-> 	    groups[0] = NULL;
#  227|   	    groupCount = 1;
#  228|   	}

Error: COMPILER_WARNING (CWE-477): [#def21]
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c: scope_hint: In function ‘econf_read’
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c:286:9: warning[-Wdeprecated-declarations]: ‘econf_readDirs’ is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead
#  286 |         econf_error = econf_readDirs(key_file, usr_root_dir, root_dir, conf_basename,
#      |         ^~~~~~~~~~~
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c:33: included_from: Included from here.
libeconf-0.7.4-build/libeconf-0.7.4/include/libeconf.h:497:1: note: declared here
#  497 | econf_readDirs(econf_file **key_file,
#      | ^~~~~~~~~~~~~~
#  284|   				     delimiters, comment);
#  285|       } else {
#  286|->         econf_error = econf_readDirs(key_file, usr_root_dir, root_dir, conf_basename,
#  287|   				     conf_suffix, delimiters, comment);
#  288|       }

Error: COMPILER_WARNING (CWE-477): [#def22]
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c: scope_hint: In function ‘econf_edit’
libeconf-0.7.4-build/libeconf-0.7.4/util/econftool.c:435:9: warning[-Wdeprecated-declarations]: ‘econf_readDirs’ is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead
#  435 |         econf_error = econf_readDirs(key_file, usr_root_dir, root_dir, conf_basename, conf_suffix, delimiters, comment);
#      |         ^~~~~~~~~~~
libeconf-0.7.4-build/libeconf-0.7.4/include/libeconf.h:497:1: note: declared here
#  497 | econf_readDirs(econf_file **key_file,
#      | ^~~~~~~~~~~~~~
#  433|   				     delimiters, comment);
#  434|       } else {
#  435|->         econf_error = econf_readDirs(key_file, usr_root_dir, root_dir, conf_basename, conf_suffix, delimiters, comment);
#  436|       }
#  437|   

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-53.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibeconf-0.7.4-3.fc42
store-results-to/tmp/tmp_1a9e9x0/libeconf-0.7.4-3.fc42.tar.xz
time-created2024-11-13 01:20:22
time-finished2024-11-13 01:21:35
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp_1a9e9x0/libeconf-0.7.4-3.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp_1a9e9x0/libeconf-0.7.4-3.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9