libeconf-0.6.2-2.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c: scope_hint: In function ‘join_same_entries’
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:56:35: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup("")’
#   54|   	  /* reset entry */
#   55|   	  free(ef->file_entry[i].value);
#   56|-> 	  ef->file_entry[i].value = strdup("");
#   57|   	} else {
#   58|   	  /* appending value */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:104:53: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(post)’
#  102|               if (pre == NULL)
#  103|   	    {
#  104|-> 	      ef->file_entry[i].comment_after_value = strdup(post);
#  105|   	    } else {
#  106|   	      int ret = asprintf(&(ef->file_entry[i].comment_after_value),

Error: CLANG_WARNING: [#def4]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:151:7: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
#  149|       if (comment_after_value)
#  150|       {
#  151|->       ret = -1;
#  152|         if (ef->file_entry[ef->length-1].comment_after_value)
#  153|         {

Error: CLANG_WARNING: [#def5]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:305:8: warning[unix.Malloc]: Potential leak of memory pointed to by 'content'
#  303|   			       p+1);
#  304|   	    if(ret<0) {
#  305|-> 	      free(buf);
#  306|   	      return ECONF_NOMEM;
#  307|   	    }

Error: CLANG_WARNING: [#def6]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:305:8: warning[unix.Malloc]: Potential leak of memory pointed to by 'current_comment_after_value'
#  303|   			       p+1);
#  304|   	    if(ret<0) {
#  305|-> 	      free(buf);
#  306|   	      return ECONF_NOMEM;
#  307|   	    }

Error: CLANG_WARNING: [#def7]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:321:8: warning[unix.Malloc]: Potential leak of memory pointed to by 'content'
#  319|   			       p+1);
#  320|   	    if(ret<0) {
#  321|-> 	      free(buf);
#  322|   	      return ECONF_NOMEM;
#  323|   	    }

Error: CLANG_WARNING: [#def8]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:321:8: warning[unix.Malloc]: Potential leak of memory pointed to by 'current_comment_before_key'
#  319|   			       p+1);
#  320|   	    if(ret<0) {
#  321|-> 	      free(buf);
#  322|   	      return ECONF_NOMEM;
#  323|   	    }

Error: CLANG_WARNING: [#def9]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:338:7: warning[unix.Malloc]: Potential leak of memory pointed to by 'org_buf'
#  336|       /* check for groups */
#  337|       if (name[0] == '[') {
#  338|->       name++; /* remove "[" */
#  339|         p = name + strlen(name) -1;
#  340|         while (isspace (*p)) p--;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c: scope_hint: In function ‘read_file’
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:423:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘strdup(buf)’ where non-null expected
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:34: included_from: Included from here.
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
#  421|           /* removing comments */
#  422|           for (size_t i = 0; i < strlen(comment); i++) {
#  423|-> 	  char *pt = strchr(org_buf, comment[i]);
#  424|   	  if (pt)
#  425|   	    *pt = '\0';

Error: GCC_ANALYZER_WARNING (CWE-688): [#def11]
libeconf-0.6.2-build/libeconf-0.6.2/lib/getfilecontents.c:428: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
#  426|   	}
#  427|   	/* removing \n at the end of the line */
#  428|-> 	if( org_buf[strlen(org_buf)-1] == '\n' )
#  429|   	  org_buf[strlen(org_buf)-1] = 0;
#  430|   	retval = store(ef, current_group, name, org_buf, line,

Error: CPPCHECK_WARNING: [#def12]
libeconf-0.6.2-build/libeconf-0.6.2/lib/keyfile.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

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

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

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

Error: CPPCHECK_WARNING: [#def16]
libeconf-0.6.2-build/libeconf-0.6.2/lib/libeconf.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def17]
libeconf-0.6.2-build/libeconf-0.6.2/lib/libeconf_ext.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def18]
libeconf-0.6.2-build/libeconf-0.6.2/lib/libeconf_ext.c:124:10: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'str')
#  122|     /* freeing array of strings */
#  123|     char **str = to_free->values;
#  124|->   while (*str)
#  125|       free(*str++); 
#  126|     free(to_free->values);

Error: CPPCHECK_WARNING: [#def19]
libeconf-0.6.2-build/libeconf-0.6.2/lib/mergefiles.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def20]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-457): [#def21]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:106: error[legacyUninitvar]: Uninitialized variable: error
#  104|         }
#  105|   
#  106|->     if (etcfile && !error) {
#  107|         /* <etc_conf_dir>/<config_name>.<suffix> does exist, ignore <run_conf_dir>/<config_name>.<suffix>
#  108|            and <dist_conf_dir>/<config_name>.<suffix> */

Error: CPPCHECK_WARNING: [#def22]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CLANG_WARNING: [#def23]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c:117:37: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#  115|       if (getenv("ECONFTOOL_ROOT") != NULL) {
#  116|   
#  117|->         int strlen_econftool_root = strlen(getenv("ECONFTOOL_ROOT"));
#  118|           /* check if ECONFTOOL_ROOT has already been added */
#  119|           if (strncmp(change_path, getenv("ECONFTOOL_ROOT"), strlen_econftool_root) == 0)

Error: CLANG_WARNING: [#def24]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c:119:13: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
#  117|           int strlen_econftool_root = strlen(getenv("ECONFTOOL_ROOT"));
#  118|           /* check if ECONFTOOL_ROOT has already been added */
#  119|->         if (strncmp(change_path, getenv("ECONFTOOL_ROOT"), strlen_econftool_root) == 0)
#  120|               return;
#  121|   

Error: CLANG_WARNING: [#def25]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c:129:9: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
#  127|           char *tmp = strdup(change_path);
#  128|   
#  129|->         strcpy(change_path, getenv("ECONFTOOL_ROOT"));
#  130|           strcat(change_path, tmp);
#  131|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def26]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘change_root_dir.part.0’
libeconf-0.6.2-build/libeconf-0.6.2/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): [#def27]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘pr_key_file’
libeconf-0.6.2-build/libeconf-0.6.2/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: CLANG_WARNING: [#def28]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c:236:6: warning[unix.Malloc]: Potential leak of memory pointed to by 'groups'
#  234|           econf_error = econf_getKeys(key_file, groups[g], &key_count, &keys);
#  235|           if (econf_error) {
#  236|-> 	    print_error(econf_error);
#  237|               econf_free(keys);
#  238|               return econf_error;

Error: COMPILER_WARNING (CWE-477): [#def29]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘econf_read’
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c:286:9: warning[-Wdeprecated-declarations]: ‘econf_readDirs’ is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c:33: included_from: Included from here.
libeconf-0.6.2-build/libeconf-0.6.2/include/libeconf.h:483:1: note: declared here
#  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): [#def30]
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘econf_edit’
libeconf-0.6.2-build/libeconf-0.6.2/util/econftool.c:435:9: warning[-Wdeprecated-declarations]: ‘econf_readDirs’ is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead
libeconf-0.6.2-build/libeconf-0.6.2/include/libeconf.h:483:1: note: declared here
#  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-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-215.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namelibeconf-0.6.2-2.fc41
store-results-to/tmp/tmpz5zk8b5m/libeconf-0.6.2-2.fc41.tar.xz
time-created2024-07-03 14:41:23
time-finished2024-07-03 14:42:21
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpz5zk8b5m/libeconf-0.6.2-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpz5zk8b5m/libeconf-0.6.2-2.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9