Task #90 - libeconf-0.6.2-1.fc41/scan-results.err
back to task #90download
Error: GCC_ANALYZER_WARNING (CWE-401): libeconf-0.6.2/lib/getfilecontents.c: scope_hint: In function ‘join_same_entries’ 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): 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: 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: 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: 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: 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: 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: 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): libeconf-0.6.2/lib/getfilecontents.c: scope_hint: In function ‘read_file’ 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/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): 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 (CWE-457): libeconf-0.6.2/lib/helpers.c:233: error[uninitvar]: Uninitialized variable: copied_fe.quotes # 231| copied_fe.comment_after_value = NULL; # 232| copied_fe.line_number = fe.line_number; # 233|-> return copied_fe; # 234| } Error: GCC_ANALYZER_WARNING (CWE-457): libeconf-0.6.2/lib/helpers.c: scope_hint: In function ‘cpy_file_entry’ libeconf-0.6.2/lib/helpers.c:233:10: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*(unsigned char *)((char *)&copied_fe + offsetof(struct file_entry, quotes))’ # 231| copied_fe.comment_after_value = NULL; # 232| copied_fe.line_number = fe.line_number; # 233|-> return copied_fe; # 234| } Error: GCC_ANALYZER_WARNING (CWE-401): libeconf-0.6.2/lib/keyfile.c: scope_hint: In function ‘setBoolValueNum’ 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): 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): libeconf-0.6.2/lib/keyfile.c:275:31: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup("_none_")’ libeconf-0.6.2/lib/keyfile.c:25: included_from: Included from here. libeconf-0.6.2/lib/keyfile.c:270:36: note: in expansion of macro ‘FALSE’ 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: CLANG_WARNING: 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 (CWE-457): libeconf-0.6.2/lib/readconfig.c:107: error[legacyUninitvar]: Uninitialized variable: error # 105| } # 106| # 107|-> if (etcfile && !error) { # 108| /* <etc_conf_dir>/<config_name>.<suffix> does exist, ignore <run_conf_dir>/<config_name>.<suffix> # 109| and <dist_conf_dir>/<config_name>.<suffix> */ Error: GCC_ANALYZER_WARNING (CWE-457): libeconf-0.6.2/lib/readconfig.c: scope_hint: In function ‘readConfigHistoryWithCallback’ libeconf-0.6.2/lib/readconfig.c:172:30: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘suffix’ # 170| if (conf_count == 0) # 171| { # 172|-> char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */ # 173| if (suffix_d == NULL) { # 174| free(*key_files); Error: COMPILER_WARNING (CWE-457): libeconf-0.6.2/lib/readconfig.c: scope_hint: In function ‘readConfigHistoryWithCallback’ libeconf-0.6.2/lib/readconfig.c:172:30: warning[-Wmaybe-uninitialized]: ‘suffix’ may be used uninitialized # 172 | char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */ # | ^~~~~~~~~~~~~~ libeconf-0.6.2/lib/readconfig.c:30:15: note: ‘suffix’ was declared here # 30 | const char *suffix, *default_dirs[4] = {NULL, NULL, NULL, NULL}; # | ^~~~~~ # 170| if (conf_count == 0) # 171| { # 172|-> char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */ # 173| if (suffix_d == NULL) { # 174| free(*key_files); Error: CLANG_WARNING: libeconf-0.6.2/lib/readconfig.c:172:30: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 170| if (conf_count == 0) # 171| { # 172|-> char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */ # 173| if (suffix_d == NULL) { # 174| free(*key_files); Error: CLANG_WARNING: libeconf-0.6.2/lib/readconfig.c:174:7: warning[unix.Malloc]: Potential leak of memory pointed to by 'configure_dirs' # 172| char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */ # 173| if (suffix_d == NULL) { # 174|-> free(*key_files); # 175| *key_files = NULL; # 176| return ECONF_NOMEM; Error: CPPCHECK_WARNING (CWE-401): libeconf-0.6.2/lib/readconfig.c:176: error[memleak]: Memory leak: configure_dirs # 174| free(*key_files); # 175| *key_files = NULL; # 176|-> return ECONF_NOMEM; # 177| } # 178| cp = stpcpy(suffix_d, suffix); Error: GCC_ANALYZER_WARNING (CWE-457): libeconf-0.6.2/lib/readconfig.c:201:13: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘suffix’ # 199| while (default_dirs[i]) { # 200| char *project_path = combine_strings(default_dirs[i], config_name, '/'); # 201|-> error = traverse_conf_dirs(key_files, configure_dirs, size, project_path, # 202| suffix, delim, comment, callback, callback_data); # 203| free(project_path); Error: CLANG_WARNING: libeconf-0.6.2/lib/readconfig.c:201:13: warning[core.CallAndMessage]: 5th function call argument is an uninitialized value # 199| while (default_dirs[i]) { # 200| char *project_path = combine_strings(default_dirs[i], config_name, '/'); # 201|-> error = traverse_conf_dirs(key_files, configure_dirs, size, project_path, # 202| suffix, delim, comment, callback, callback_data); # 203| free(project_path); Error: CLANG_WARNING: 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: 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: 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): libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘change_root_dir.part.0’ 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): libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘pr_key_file’ 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: 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): libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘econf_read’ libeconf-0.6.2/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.6.2/util/econftool.c:33: included_from: Included from here. libeconf-0.6.2/include/libeconf.h:483:1: note: declared here # 483 | 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): libeconf-0.6.2/util/econftool.c: scope_hint: In function ‘econf_edit’ libeconf-0.6.2/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.6.2/include/libeconf.h:483:1: note: declared here # 483 | 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|