Task #4613 - bash-5.2.26-4.fc41/scan-results.err
back to task #4613download
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/array.c:66:14: warning[-Wunused-variable]: ‘spacesep’ defined but not used
# 66 | static char *spacesep = " ";
# | ^~~~~~~~
# 64| static char *array_to_string_internal PARAMS((ARRAY_ELEMENT *, ARRAY_ELEMENT *, char *, int));
# 65|
# 66|-> static char *spacesep = " ";
# 67|
# 68| #define IS_LASTREF(a) (a->lastref)
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/array.c:870: error[uninitvar]: Uninitialized variable: t
# 868| {
# 869| for (i = 0; i < count; i++)
# 870|-> array_insert (a, i, t);
# 871| return a;
# 872| }
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/array.c: scope_hint: In function ‘array_from_argv’
bash-5.2.26-build/bash-5.2/array.c:870:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘t’
# 868| {
# 869| for (i = 0; i < count; i++)
# 870|-> array_insert (a, i, t);
# 871| return a;
# 872| }
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/array.c: scope_hint: In function ‘array_from_argv’
bash-5.2.26-build/bash-5.2/array.c:870:9: warning[-Wmaybe-uninitialized]: ‘t’ may be used uninitialized
# 870 | array_insert (a, i, t);
# | ^~~~~~~~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/array.c:865:10: note: ‘t’ was declared here
# 865 | char *t;
# | ^
# 868| {
# 869| for (i = 0; i < count; i++)
# 870|-> array_insert (a, i, t);
# 871| return a;
# 872| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/arrayfunc.c: scope_hint: In function ‘assign_array_element_internal’
bash-5.2.26-build/bash-5.2/arrayfunc.c:407:9: warning[-Wunused-variable]: unused variable ‘newval’
# 407 | char *newval;
# | ^~~~~~
# 405| char *akey, *nkey;
# 406| arrayind_t ind;
# 407|-> char *newval;
# 408|
# 409| /* rely on the caller to initialize estatep */
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/arrayfunc.c:432:36: warning[-Wmaybe-uninitialized]: ‘nkey’ may be used uninitialized
# 432 | estatep->value = entry ? assoc_reference (assoc_cell (entry), nkey) : 0;
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/arrayfunc.c: scope_hint: In function ‘assign_array_element’
bash-5.2.26-build/bash-5.2/arrayfunc.c:405:16: note: ‘nkey’ was declared here
# 405 | char *akey, *nkey;
# | ^~~~
# 430| estatep->type = ARRAY_ASSOC;
# 431| estatep->key = nkey;
# 432|-> estatep->value = entry ? assoc_reference (assoc_cell (entry), nkey) : 0;
# 433| }
# 434| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/arrayfunc.c: scope_hint: In function ‘array_value_internal’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1483:21: warning[-Wunused-but-set-variable]: variable ‘subtype’ set but not used
# 1483 | int len, isassoc, subtype;
# | ^~~~~~~
# 1481| array_eltstate_t *estatep;
# 1482| {
# 1483|-> int len, isassoc, subtype;
# 1484| arrayind_t ind;
# 1485| char *akey;
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/arrayfunc.c: scope_hint: In function ‘array_value_internal’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1615:48: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ind’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1585:16: note: in expansion of macro ‘assoc_p’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1604:23: note: in expansion of macro ‘value_cell’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1609:16: note: in expansion of macro ‘invisible_p’
# 1613| }
# 1614| if (array_p (var) == 0 && assoc_p (var) == 0)
# 1615|-> retval = (ind == 0) ? value_cell (var) : (char *)NULL;
# 1616| else if (assoc_p (var))
# 1617| {
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/arrayfunc.c: scope_hint: In function ‘array_value_internal’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1615:48: warning[-Wmaybe-uninitialized]: ‘ind’ may be used uninitialized
# 1615 | retval = (ind == 0) ? value_cell (var) : (char *)NULL;
# | ^
bash-5.2.26-build/bash-5.2/arrayfunc.c:1484:14: note: ‘ind’ was declared here
# 1484 | arrayind_t ind;
# | ^~~
# 1613| }
# 1614| if (array_p (var) == 0 && assoc_p (var) == 0)
# 1615|-> retval = (ind == 0) ? value_cell (var) : (char *)NULL;
# 1616| else if (assoc_p (var))
# 1617| {
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/arrayfunc.c:1627:18: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ind’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1585:16: note: in expansion of macro ‘assoc_p’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1604:23: note: in expansion of macro ‘value_cell’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1609:16: note: in expansion of macro ‘invisible_p’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1616:16: note: in expansion of macro ‘assoc_p’
# 1625| }
# 1626| else
# 1627|-> retval = array_reference (array_cell (var), ind);
# 1628|
# 1629| if (estatep)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/arrayfunc.c: scope_hint: In function ‘array_keys’
bash-5.2.26-build/bash-5.2/arrayfunc.c:1672:22: warning[-Wunused-variable]: unused variable ‘temp’
# 1672 | char *retval, *t, *temp;
# | ^~~~
# 1670| {
# 1671| int len;
# 1672|-> char *retval, *t, *temp;
# 1673| WORD_LIST *l;
# 1674| SHELL_VAR *var;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/assoc.h:31:37: warning[-Wmaybe-uninitialized]: ‘h’ may be used uninitialized
# 31 | #define assoc_num_elements(h) ((h)->nentries)
# | ~~~~^~~~~~~~~~~
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_substring’
bash-5.2.26-build/bash-5.2/subst.c:8124:14: note: ‘h’ was declared here
# 8124 | HASH_TABLE *h;
# | ^
# 29|
# 30| #define assoc_empty(h) ((h)->nentries == 0)
# 31|-> #define assoc_num_elements(h) ((h)->nentries)
# 32|
# 33| #define assoc_create(n) (hash_create((n)))
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashhist.c: scope_hint: In function ‘hc_erasedups’
bash-5.2.26-build/bash-5.2/bashhist.c:731:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 731 | while (temp = previous_history ())
# | ^~~~
# 729|
# 730| using_history ();
# 731|-> while (temp = previous_history ())
# 732| {
# 733| if (STREQ (temp->line, line))
Error: COMPILER_WARNING (CWE-704):
bash-5.2.26-build/bash-5.2/bashhist.c: scope_hint: In function ‘bash_syslog_history’
bash-5.2.26-build/bash-5.2/bashhist.c:851:16: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 851 | for (msg = line, i = 0; i < chunks; i++)
# | ^
# 849| {
# 850| chunks = ((msglen + hdrlen) / SYSLOG_MAXLEN) + 1;
# 851|-> for (msg = line, i = 0; i < chunks; i++)
# 852| {
# 853| seqnum = inttostr (i + 1, seqbuf, sizeof (seqbuf));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/bashline.c:214:12: warning[-Wunused-function]: ‘set_saved_history’ declared ‘static’ but never defined
# 214 | static int set_saved_history PARAMS((void));
# | ^~~~~~~~~~~~~~~~~
# 212| static int isolate_sequence PARAMS((char *, int, int, int *));
# 213|
# 214|-> static int set_saved_history PARAMS((void));
# 215|
# 216| #if defined (ALIAS)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘snarf_hosts_from_file’
bash-5.2.26-build/bash-5.2/bashline.c:811:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 811 | while (temp = fgets (buffer, 255, file))
# | ^~~~
# 809| return;
# 810|
# 811|-> while (temp = fgets (buffer, 255, file))
# 812| {
# 813| /* Skip to first character. */
Error: GCC_ANALYZER_WARNING (CWE-835):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘snarf_hosts_from_file’
bash-5.2.26-build/bash-5.2/bashline.c:842:22: warning[-Wanalyzer-infinite-loop]: infinite loop
bash-5.2.26-build/bash-5.2/bashline.c:842:29: note: in expansion of macro ‘cr_whitespace’
# 840| /* Skip internet address if present. */
# 841| if (DIGIT (buffer[i]))
# 842|-> for (; buffer[i] && cr_whitespace (buffer[i]) == 0; i++);
# 843|
# 844| /* Gobble up names. Each name is separated with whitespace. */
Error: GCC_ANALYZER_WARNING (CWE-835):
bash-5.2.26-build/bash-5.2/bashline.c:853:33: warning[-Wanalyzer-infinite-loop]: infinite loop
bash-5.2.26-build/bash-5.2/bashline.c:853:40: note: in expansion of macro ‘cr_whitespace’
# 851|
# 852| /* Isolate the current word. */
# 853|-> for (start = i; buffer[i] && cr_whitespace (buffer[i]) == 0; i++)
# 854| ;
# 855| if (i == start)
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_backward_kill_shellword’
bash-5.2.26-build/bash-5.2/bashline.c:1245:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion
# 1243|
# 1244| if (count < 0)
# 1245|-> return (bash_backward_kill_shellword (-count, key));
# 1246|
# 1247| p = rl_point;
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_kill_shellword’
bash-5.2.26-build/bash-5.2/bashline.c:1267:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion
# 1265|
# 1266| if (count < 0)
# 1267|-> return (bash_kill_shellword (-count, key));
# 1268|
# 1269| p = rl_point;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_spell_correct_shellword’
bash-5.2.26-build/bash-5.2/bashline.c:1346:7: warning[-Wunused-but-set-variable]: variable ‘opoint’ set but not used
# 1346 | int opoint, wbeg, wend;
# | ^~~~~~
# 1344| int count, key;
# 1345| {
# 1346|-> int opoint, wbeg, wend;
# 1347| char *text, *newdir;
# 1348|
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/bashline.c:1687: error[uninitvar]: Uninitialized variable: e1
# 1685| if (s > rl_end)
# 1686| {
# 1687|-> s1 = s = e1;
# 1688| break;
# 1689| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘attempt_shell_completion’
bash-5.2.26-build/bash-5.2/bashline.c:1704:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1704 | while (was_assignment = assignment (n, 0));
# | ^~~~~~~~~~~~~~
# 1702| s = e1 + 1;
# 1703| }
# 1704|-> while (was_assignment = assignment (n, 0));
# 1705| s = s1; /* reset to index where name begins */
# 1706|
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘attempt_shell_completion’
bash-5.2.26-build/bash-5.2/bashline.c:1719:28: warning[-Wmaybe-uninitialized]: ‘e1’ may be used uninitialized
# 1719 | else if (e == 0 && e == s && text[0] == '\0' && have_progcomps) /* beginning of empty line */
# | ~~^~~~
bash-5.2.26-build/bash-5.2/bashline.c:1669:21: note: ‘e1’ was declared here
# 1669 | int s, e, s1, e1, os, foundcs;
# | ^~
# 1717| else if (start == end && start == s1 && e != 0 && e1 > end) /* beginning of command name, leading whitespace */
# 1718| foundcs = 0;
# 1719|-> else if (e == 0 && e == s && text[0] == '\0' && have_progcomps) /* beginning of empty line */
# 1720| prog_complete_matches = programmable_completions (EMPTYCMD, text, s, e, &foundcs);
# 1721| else if (start == end && text[0] == '\0' && s1 > start && whitespace (rl_line_buffer[start]))
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘command_word_completion_function’
bash-5.2.26-build/bash-5.2/bashline.c:2209:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2209 | while (val = glob_matches[local_index++])
# | ^~~
# 2207| }
# 2208|
# 2209|-> while (val = glob_matches[local_index++])
# 2210| {
# 2211| if (executable_or_directory (val))
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_servicename_completion_function’
bash-5.2.26-build/bash-5.2/bashline.c:2609:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2609 | while (srvent = getservent ())
# | ^~~~~~
# 2607| }
# 2608|
# 2609|-> while (srvent = getservent ())
# 2610| {
# 2611| afound = 0;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_groupname_completion_function’
bash-5.2.26-build/bash-5.2/bashline.c:2665:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2665 | while (grent = getgrent ())
# | ^~~~~
# 2663| }
# 2664|
# 2665|-> while (grent = getgrent ())
# 2666| {
# 2667| if (gnamelen == 0 || (STREQN (gname, grent->gr_name, gnamelen)))
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘history_and_alias_expand_line’
bash-5.2.26-build/bash-5.2/bashline.c:2847:20: warning[-Wunused-variable]: unused variable ‘t’
# 2847 | char *new_line, *t;
# | ^
# 2845| int count, ignore;
# 2846| {
# 2847|-> char *new_line, *t;
# 2848|
# 2849| new_line = 0;
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘_ignore_completion_names’
bash-5.2.26-build/bash-5.2/bashline.c:3027:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldnames’
# 3025| newnames[nidx++] = names[idx];
# 3026| else if (force_fignore == 0)
# 3027|-> oldnames[oidx++] = names[idx];
# 3028| else
# 3029| free (names[idx]);
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘_ignore_completion_names’
bash-5.2.26-build/bash-5.2/bashline.c:3027:17: warning[-Wmaybe-uninitialized]: ‘oldnames’ may be used uninitialized
# 3027 | oldnames[oidx++] = names[idx];
# | ^
bash-5.2.26-build/bash-5.2/bashline.c:2990:10: note: ‘oldnames’ was declared here
# 2990 | char **oldnames;
# | ^~~~~~~~
# 3025| newnames[nidx++] = names[idx];
# 3026| else if (force_fignore == 0)
# 3027|-> oldnames[oidx++] = names[idx];
# 3028| else
# 3029| free (names[idx]);
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/bashline.c:3043:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldnames’
# 3041| }
# 3042| else
# 3043|-> free (oldnames);
# 3044|
# 3045| free (newnames);
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/bashline.c:3053:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldnames’
# 3051| while (oidx)
# 3052| free (oldnames[--oidx]);
# 3053|-> free (oldnames);
# 3054| }
# 3055|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_filename_stat_hook’
bash-5.2.26-build/bash-5.2/bashline.c:3385:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3385 | if (t = mbschr (local_dirname, '$'))
# | ^
# 3383| local_dirname = *dirname;
# 3384| should_expand_dirname = return_value = 0;
# 3385|-> if (t = mbschr (local_dirname, '$'))
# 3386| should_expand_dirname = '$';
# 3387| else if (t = mbschr (local_dirname, '`')) /* XXX */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c:3387:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3387 | else if (t = mbschr (local_dirname, '`')) /* XXX */
# | ^
# 3385| if (t = mbschr (local_dirname, '$'))
# 3386| should_expand_dirname = '$';
# 3387|-> else if (t = mbschr (local_dirname, '`')) /* XXX */
# 3388| should_expand_dirname = '`';
# 3389|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_directory_completion_hook’
bash-5.2.26-build/bash-5.2/bashline.c:3540:18: warning[-Wunused-variable]: unused variable ‘l1’
# 3540 | size_t l1, l2;
# | ^~
# 3538| if (temp2 == 0 && dircomplete_spelling && dircomplete_expand)
# 3539| {
# 3540|-> size_t l1, l2;
# 3541|
# 3542| temp2 = dirspell (temp1);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_check_expchar’
bash-5.2.26-build/bash-5.2/bashline.c:4172:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4172 | if (t = mbschr (dirname, '$'))
# | ^
# 4170|
# 4171| ret = n = c = 0;
# 4172|-> if (t = mbschr (dirname, '$'))
# 4173| {
# 4174| ret = '$';
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘set_filename_quote_chars’
bash-5.2.26-build/bash-5.2/bashline.c:4231:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4231 | for (i = j = 0; c = default_filename_quote_characters[i]; i++)
# | ^
# 4229| i = strlen (default_filename_quote_characters);
# 4230| custom_filename_quote_characters = xrealloc (custom_filename_quote_characters, i+1);
# 4231|-> for (i = j = 0; c = default_filename_quote_characters[i]; i++)
# 4232| {
# 4233| if (c == expchar || c == nextch || c == closer)
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/bashline.c:4386:1: warning[-Wunused-function]: ‘putx’ defined but not used
# 4386 | putx(c)
# | ^~~~
# 4384| static int
# 4385| #endif
# 4386|-> putx(c)
# 4387| int c;
# 4388| {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_execute_unix_command’
bash-5.2.26-build/bash-5.2/bashline.c:4447:27: warning[-Wunused-variable]: unused variable ‘old_ch’
# 4447 | char *cmd, *value, *ce, old_ch;
# | ^~~~~~
# 4445| intmax_t mi;
# 4446| sh_parser_state_t ps;
# 4447|-> char *cmd, *value, *ce, old_ch;
# 4448| SHELL_VAR *v;
# 4449| char ibuf[INT_STRLEN_BOUND(int) + 1];
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/bashline.c:4584:1: warning[-Wunused-function]: ‘get_cmd_xmap_from_edit_mode’ defined but not used
# 4584 | get_cmd_xmap_from_edit_mode ()
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 4582|
# 4583| static Keymap
# 4584|-> get_cmd_xmap_from_edit_mode ()
# 4585| {
# 4586| if (emacs_std_cmd_xmap == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘isolate_sequence’
bash-5.2.26-build/bash-5.2/bashline.c:4649:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4649 | for (passc = 0; c = string[i]; i++)
# | ^
# 4647| *startp = delim ? ++i : i;
# 4648|
# 4649|-> for (passc = 0; c = string[i]; i++)
# 4650| {
# 4651| if (passc)
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/braces.c:371:13: warning[-Wmaybe-uninitialized]: ‘tr’ may be used uninitialized
# 371 | if (start > end && incr > 0)
# | ~~~~~~^~~~~
bash-5.2.26-build/bash-5.2/braces.c: scope_hint: In function ‘brace_expand’
bash-5.2.26-build/bash-5.2/braces.c:479:16: note: ‘tr’ was declared here
# 479 | intmax_t tl, tr;
# | ^~
# 369| incr = 1;
# 370|
# 371|-> if (start > end && incr > 0)
# 372| incr = -incr;
# 373| else if (start < end && incr < 0)
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/braces.c: scope_hint: In function ‘mkseq’
bash-5.2.26-build/bash-5.2/braces.c:425:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘result’
# 423| #endif
# 424| if (type == ST_INT)
# 425|-> result[i++] = t = itos (n);
# 426| else if (type == ST_ZINT)
# 427| {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/braces.c: scope_hint: In function ‘mkseq’
bash-5.2.26-build/bash-5.2/braces.c:428:15: warning[-Wunused-but-set-variable]: variable ‘len’ set but not used
# 428 | int len, arg;
# | ^~~
# 426| else if (type == ST_ZINT)
# 427| {
# 428|-> int len, arg;
# 429| arg = n;
# 430| len = asprintf (&t, "%0*d", width, arg);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/braces.c:435:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 435 | if (t = (char *)malloc (2))
# | ^
# 433| else
# 434| {
# 435|-> if (t = (char *)malloc (2))
# 436| {
# 437| t[0] = n;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/braces.c: scope_hint: In function ‘brace_gobbler’
bash-5.2.26-build/bash-5.2/braces.c:615:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 615 | while (c = text[i])
# | ^
# 613|
# 614| i = *indx;
# 615|-> while (c = text[i])
# 616| {
# 617| if (pass_next)
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/builtins/cd.def: scope_hint: At top level
bash-5.2.26-build/bash-5.2/builtins/cd.def:198:1: warning[-Wunused-function]: ‘cdxattr’ defined but not used
# 198 | cdxattr (dir, ndirp)
# | ^~~~~~~
# 196|
# 197| static int
# 198|-> cdxattr (dir, ndirp)
# 199| char *dir; /* don't assume we can always free DIR */
# 200| char **ndirp; /* return new constructed directory name */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/cd.def: scope_hint: In function ‘cd_builtin’
bash-5.2.26-build/bash-5.2/builtins/cd.def:370:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 370 | while (path = extract_colon_unit (cdpath, &path_index))
# | ^~~~
# 368| /* Find directory in $CDPATH. */
# 369| path_index = 0;
# 370|-> while (path = extract_colon_unit (cdpath, &path_index))
# 371| {
# 372| /* OPT is 1 if the path element is non-empty */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/cd.def: scope_hint: In function ‘change_to_directory’
bash-5.2.26-build/bash-5.2/builtins/cd.def:555:20: warning[-Wunused-variable]: unused variable ‘ndir’
# 555 | char *t, *tdir, *ndir;
# | ^~~~
# 553| int nolinks, xattr;
# 554| {
# 555|-> char *t, *tdir, *ndir;
# 556| int err, canon_failed, r, ndlen;
# 557|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/common.c: scope_hint: In function ‘builtin_arrayref_flags’
bash-5.2.26-build/bash-5.2/builtins/common.c:1088:9: warning[-Wunused-variable]: unused variable ‘t’
# 1088 | char *t;
# | ^
# 1086| int baseflags;
# 1087| {
# 1088|-> char *t;
# 1089| int vflags;
# 1090|
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/declare.def:387:7: warning[-Wmaybe-uninitialized]: ‘optchar’ may be used uninitialized
# 387 | sh_invalidopt (optchar);
# | ^~~~~~~~~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/builtins/declare.def:376:13: note: ‘optchar’ was declared here
# 376 | char *optchar;
# | ^~~~~~~
# 385| optchar = "-a";
# 386|
# 387|-> sh_invalidopt (optchar);
# 388| return (EXECUTION_FAILURE);
# 389| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/declare.def:401:11: warning[-Wunused-but-set-variable]: variable ‘var_exists’ set but not used
# 401 | int var_exists, array_exists, creating_array, array_subscript_assignment;
# | ^~~~~~~~~~
# 399| #if defined (ARRAY_VARS)
# 400| int making_array_special, compound_array_assign, simple_array_assign;
# 401|-> int var_exists, array_exists, creating_array, array_subscript_assignment;
# 402| #endif
# 403|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/declare.def: scope_hint: In function ‘declare_internal’
bash-5.2.26-build/bash-5.2/builtins/declare.def:566:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 566 | if (t = strchr (name, '[')) /* ] */
# | ^
# 564| compound_array_assign = simple_array_assign = 0;
# 565| array_subscript_assignment = 0;
# 566|-> if (t = strchr (name, '[')) /* ] */
# 567| {
# 568| /* If offset != 0 we have already validated any array reference
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/echo.def: scope_hint: In function ‘echo_builtin’
bash-5.2.26-build/bash-5.2/builtins/echo.def:141:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 141 | while (i = *temp++)
# | ^
# 139| /* All of the options in TEMP are valid options to ECHO.
# 140| Handle them. */
# 141|-> while (i = *temp++)
# 142| {
# 143| switch (i)
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/enable.def: scope_hint: In function ‘enable_builtin’
bash-5.2.26-build/bash-5.2/builtins/enable.def:192:16: warning[-Wmaybe-uninitialized]: ‘filename’ may be used uninitialized
# 192 | result = dyn_load_builtin (list, filter, filename);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/builtins/enable.def:116:9: note: ‘filename’ was declared here
# 116 | char *filename;
# | ^~~~~~~~
# 190| filter |= SPECIAL;
# 191|
# 192|-> result = dyn_load_builtin (list, filter, filename);
# 193| if (result != EXECUTION_SUCCESS)
# 194| result = EXECUTION_FAILURE; /* normalize return value */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/evalstring.c: scope_hint: In function ‘parse_and_execute’
bash-5.2.26-build/bash-5.2/builtins/evalstring.c:443:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 443 | else if (command = global_command)
# | ^~~~~~~
# 441| global_command = (COMMAND *)NULL;
# 442| }
# 443|-> else if (command = global_command)
# 444| {
# 445| struct fd_bitmap *bitmap;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/evalstring.c: scope_hint: In function ‘open_redir_file’
bash-5.2.26-build/bash-5.2/builtins/evalstring.c:735:11: warning[-Wunused-variable]: unused variable ‘rval’
# 735 | int fd, rval;
# | ^~~~
# 733| {
# 734| char *fn;
# 735|-> int fd, rval;
# 736|
# 737| if (r->instruction != r_input_direction)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/getopt.c: scope_hint: In function ‘sh_getopt’
bash-5.2.26-build/bash-5.2/builtins/getopt.c:182:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 182 | if (sh_badopt = (temp == NULL || c == ':'))
# | ^~~~~~~~~
# 180| }
# 181|
# 182|-> if (sh_badopt = (temp == NULL || c == ':'))
# 183| {
# 184| if (sh_opterr)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/help.def: scope_hint: In function ‘help_builtin’
bash-5.2.26-build/bash-5.2/builtins/help.def:145:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 145 | for (i = 0; name = shell_builtins[i].name; i++)
# | ^~~~
# 143| for (pass = 1, this_found = 0; pass < 3; pass++)
# 144| {
# 145|-> for (i = 0; name = shell_builtins[i].name; i++)
# 146| {
# 147| QUIT;
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/builtins/help.def: scope_hint: In function ‘show_longdoc’
bash-5.2.26-build/bash-5.2/builtins/help.def:245:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’
# 243| {
# 244| fd = open_helpfile (doc[0]);
# 245|-> if (fd < 0)
# 246| return;
# 247| zcatfd (fd, 1, doc[0]);
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/help.def: scope_hint: In function ‘show_desc’
bash-5.2.26-build/bash-5.2/builtins/help.def:260:19: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used
# 260 | register int j, r;
# | ^
# 258| int i;
# 259| {
# 260|-> register int j, r;
# 261| char **doc, *line;
# 262| int fd, usefile;
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/builtins/help.def: scope_hint: In function ‘show_desc’
bash-5.2.26-build/bash-5.2/builtins/help.def:270:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’
# 268| {
# 269| fd = open_helpfile (doc[0]);
# 270|-> if (fd < 0)
# 271| return;
# 272| r = zmapfd (fd, &line, doc[0]);
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/builtins/help.def: scope_hint: In function ‘show_manpage’
bash-5.2.26-build/bash-5.2/builtins/help.def:309:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’
# 307| {
# 308| fd = open_helpfile (doc[0]);
# 309|-> if (fd < 0)
# 310| return;
# 311| zmapfd (fd, &line, doc[0]);
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/builtins/help.def:336:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘doc’
# 334| if (usefile == 0)
# 335| {
# 336|-> for (j = 0; doc[j]; j++)
# 337| printf ("%*s%s\n", BASE_INDENT, " ", _(doc[j]));
# 338| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/help.def:518:10: warning[-Wunused-variable]: unused variable ‘j’
# 518 | int i, j;
# | ^
# 516| show_builtin_command_help ()
# 517| {
# 518|-> int i, j;
# 519| int height, width;
# 520| char *t, blurb[128];
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/help.def: scope_hint: In function ‘show_builtin_command_help’
bash-5.2.26-build/bash-5.2/builtins/help.def:520:9: warning[-Wunused-variable]: unused variable ‘t’
# 520 | char *t, blurb[128];
# | ^
# 518| int i, j;
# 519| int height, width;
# 520|-> char *t, blurb[128];
# 521|
# 522| printf (
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/history.def: scope_hint: In function ‘history_builtin’
bash-5.2.26-build/bash-5.2/builtins/history.def:185:59: warning[-Wmaybe-uninitialized]: ‘delete_arg’ may be used uninitialized
# 185 | else if ((flags & DFLAG) && (range = strchr ((delete_arg[0] == '-') ? delete_arg + 1 : delete_arg, '-')))
# | ~~~~~~~~~~^~~
bash-5.2.26-build/bash-5.2/builtins/history.def:112:20: note: ‘delete_arg’ was declared here
# 112 | char *filename, *delete_arg, *range;
# | ^~~~~~~~~~
# 183| }
# 184| #endif
# 185|-> else if ((flags & DFLAG) && (range = strchr ((delete_arg[0] == '-') ? delete_arg + 1 : delete_arg, '-')))
# 186| {
# 187| intmax_t delete_start, delete_end;
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/let.def:108: warning[uninitvar]: Uninitialized variable: ret
# 106| }
# 107|
# 108|-> return ((ret == 0) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
# 109| }
# 110|
Error: GCC_ANALYZER_WARNING (CWE-131):
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c: scope_hint: In function ‘array_add’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:452:18: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’
# 450| {
# 451| if (array->sindex + 2 > array->size)
# 452|-> array->array = (char **)xrealloc
# 453| (array->array, (array->size += array->growth_rate) * array->width);
# 454|
Error: GCC_ANALYZER_WARNING (CWE-401):
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:457:1: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1112:15: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:1113:19: note: in expansion of macro ‘savestring’
# 455| array->array[array->sindex++] = element;
# 456| array->array[array->sindex] = (char *)NULL;
# 457|-> }
# 458|
# 459| /* Free an allocated array and data pointer. */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c: scope_hint: In function ‘extract_info’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:603:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 603 | for (i = 0; line = defs->lines->array[i]; i++)
# | ^~~~
# 601|
# 602| /* Process each line in the array. */
# 603|-> for (i = 0; line = defs->lines->array[i]; i++)
# 604| {
# 605| defs->line_number = i;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c: scope_hint: In function ‘free_defs’
bash-5.2.26-build/bash-5.2/builtins/mkbuiltins.c:719:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 719 | for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++)
# | ^~~~~~~
# 717| if (defs->builtins)
# 718| {
# 719|-> for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++)
# 720| {
# 721| free_builtin (builtin);
Error: GCC_ANALYZER_WARNING (CWE-479):
bash-5.2.26-build/bash-5.2/builtins/psize.c: scope_hint: In function ‘sigpipe’
bash-5.2.26-build/bash-5.2/builtins/psize.c:54:3: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘fprintf’ from within signal handler
# 52| int sig;
# 53| {
# 54|-> fprintf (stderr, "%d\n", nw);
# 55| exit (0);
# 56| }
Error: GCC_ANALYZER_WARNING (CWE-479):
bash-5.2.26-build/bash-5.2/builtins/psize.c:55:3: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler
bash-5.2.26-build/bash-5.2/builtins/psize.c:55:3: note: ‘_exit’ is a possible signal-safe alternative for ‘exit’
# 53| {
# 54| fprintf (stderr, "%d\n", nw);
# 55|-> exit (0);
# 56| }
# 57|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/read.def:144:20: warning[-Wunused-variable]: ‘old_alrm’ defined but not used
# 144 | static SigHandler *old_alrm;
# | ^~~~~~~~
# 142|
# 143| static int reading, tty_modified;
# 144|-> static SigHandler *old_alrm;
# 145| static unsigned char delim;
# 146|
Error: CPPCHECK_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/builtins/read.def:795: error[nullPointer]: Null pointer dereference
# 793| {
# 794| size_t clen;
# 795|-> clen = mbrlen (rlbuf + rlind - 1, mb_cur_max, (mbstate_t *)NULL);
# 796| /* We only deal with valid multibyte sequences longer than one
# 797| byte. If we get anything else, we leave the one character
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/read.def: scope_hint: In function ‘read_builtin’
bash-5.2.26-build/bash-5.2/builtins/read.def:917:11: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘saw_escape’
# 915| #endif
# 916|
# 917|-> if (saw_escape)
# 918| {
# 919| t = dequote_string (input_string);
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/set.def:573: warning[uninitvar]: Uninitialized variable: tflag
# 571| for (i = vptr = 0; o_options[i].name; i++)
# 572| {
# 573|-> if (tflag[i])
# 574| {
# 575| strcpy (value + vptr, o_options[i].name);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/set.def: scope_hint: In function ‘parse_shellopts’
bash-5.2.26-build/bash-5.2/builtins/set.def:617:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 617 | while (vname = extract_colon_unit (value, &vptr))
# | ^~~~~
# 615|
# 616| vptr = 0;
# 617|-> while (vname = extract_colon_unit (value, &vptr))
# 618| {
# 619| set_minus_o_option (FLAG_ON, vname);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/set.def: scope_hint: In function ‘set_builtin’
bash-5.2.26-build/bash-5.2/builtins/set.def:742:18: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 742 | while (flag_name = *++arg)
# | ^~~~~~~~~
# 740| if ((on_or_off = *arg) && (on_or_off == '-' || on_or_off == '+'))
# 741| {
# 742|-> while (flag_name = *++arg)
# 743| {
# 744| if (flag_name == '?')
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/set.def: scope_hint: In function ‘unset_builtin’
bash-5.2.26-build/bash-5.2/builtins/set.def:946:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 946 | if (var = find_function (name))
# | ^~~
# 944| if (var == 0 && nameref == 0 && unset_variable == 0 && unset_function == 0)
# 945| {
# 946|-> if (var = find_function (name))
# 947| unset_function = 1;
# 948| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/set.def:990:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 990 | if (var = array_variable_part (tname, 0, &t, &len))
# | ^~~
# 988|
# 989| tname = savestring (nameref_cell (var));
# 990|-> if (var = array_variable_part (tname, 0, &t, &len))
# 991| {
# 992| /* change to what unbind_array_element now expects */
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/set.def:1013:10: warning[-Wmaybe-uninitialized]: ‘tem’ may be used uninitialized
# 1013 | if (tem == -1 && nameref == 0 && unset_function == 0 && unset_variable == 0)
# | ^
bash-5.2.26-build/bash-5.2/builtins/set.def:882:11: note: ‘tem’ was declared here
# 882 | int tem;
# | ^~~
# 1011| that name does not exist, a function by that name, if any,
# 1012| shall be unset.'' */
# 1013|-> if (tem == -1 && nameref == 0 && unset_function == 0 && unset_variable == 0)
# 1014| tem = unbind_func (name);
# 1015|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/setattr.def: scope_hint: In function ‘set_or_show_attributes’
bash-5.2.26-build/bash-5.2/builtins/setattr.def:320:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 320 | for (i = 0; var = variable_list[i]; i++)
# | ^~~
# 318| if (variable_list)
# 319| {
# 320|-> for (i = 0; var = variable_list[i]; i++)
# 321| {
# 322| #if defined (ARRAY_VARS)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/setattr.def:337:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 337 | if (any_failed = sh_chkwrite (any_failed))
# | ^~~~~~~~~~
# 335| {
# 336| show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
# 337|-> if (any_failed = sh_chkwrite (any_failed))
# 338| break;
# 339| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/setattr.def: scope_hint: In function ‘show_all_var_attributes’
bash-5.2.26-build/bash-5.2/builtins/setattr.def:364:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 364 | for (i = any_failed = 0; var = variable_list[i]; i++)
# | ^~~
# 362| return (EXECUTION_SUCCESS);
# 363|
# 364|-> for (i = any_failed = 0; var = variable_list[i]; i++)
# 365| {
# 366| /* There is no equivalent `declare -'. */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/setattr.def:371:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 371 | if (any_failed = sh_chkwrite (any_failed))
# | ^~~~~~~~~~
# 369| else
# 370| show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
# 371|-> if (any_failed = sh_chkwrite (any_failed))
# 372| break;
# 373| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/setattr.def: scope_hint: In function ‘show_local_var_attributes’
bash-5.2.26-build/bash-5.2/builtins/setattr.def:392:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 392 | for (i = any_failed = 0; var = variable_list[i]; i++)
# | ^~~
# 390| return (EXECUTION_SUCCESS);
# 391|
# 392|-> for (i = any_failed = 0; var = variable_list[i]; i++)
# 393| {
# 394| /* There is no equivalent `declare -'. */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/setattr.def:399:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 399 | if (any_failed = sh_chkwrite (any_failed))
# | ^~~~~~~~~~
# 397| else
# 398| show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
# 399|-> if (any_failed = sh_chkwrite (any_failed))
# 400| break;
# 401| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/shopt.def: scope_hint: In function ‘toggle_shopts’
bash-5.2.26-build/bash-5.2/builtins/shopt.def:482:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 482 | if (v = find_variable ("BASHOPTS"))
# | ^
# 480|
# 481| /* Don't set $BASHOPTS here if it hasn't already been initialized */
# 482|-> if (v = find_variable ("BASHOPTS"))
# 483| set_bashopts ();
# 484| return (rval);
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/shopt.def: scope_hint: In function ‘set_compatibility_level’
bash-5.2.26-build/bash-5.2/builtins/shopt.def:712:11: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldval’
# 710| else if (shopt_compat44)
# 711| shell_compatibility_level = 44;
# 712|-> else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL)
# 713| ;
# 714| else
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/shopt.def: scope_hint: In function ‘set_compatibility_level’
bash-5.2.26-build/bash-5.2/builtins/shopt.def:712:11: warning[-Wmaybe-uninitialized]: ‘oldval’ may be used uninitialized
# 712 | else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL)
# | ^
bash-5.2.26-build/bash-5.2/builtins/shopt.def:677:12: note: ‘oldval’ was declared here
# 677 | int ind, oldval;
# | ^~~~~~
# 710| else if (shopt_compat44)
# 711| shell_compatibility_level = 44;
# 712|-> else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL)
# 713| ;
# 714| else
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/shopt.def: scope_hint: In function ‘set_bashopts’
bash-5.2.26-build/bash-5.2/builtins/shopt.def:854:24: warning[-Wunused-variable]: unused variable ‘ip’
# 854 | int vsize, i, vptr, *ip, exported;
# | ^~
# 852| char *value;
# 853| char tflag[N_SHOPT_OPTIONS];
# 854|-> int vsize, i, vptr, *ip, exported;
# 855| SHELL_VAR *v;
# 856|
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/builtins/shopt.def:871: warning[uninitvar]: Uninitialized variable: tflag
# 869| for (i = vptr = 0; shopt_vars[i].name; i++)
# 870| {
# 871|-> if (tflag[i])
# 872| {
# 873| strcpy (value + vptr, shopt_vars[i].name);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/shopt.def: scope_hint: In function ‘parse_bashopts’
bash-5.2.26-build/bash-5.2/builtins/shopt.def:915:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 915 | while (vname = extract_colon_unit (value, &vptr))
# | ^~~~~
# 913|
# 914| vptr = 0;
# 915|-> while (vname = extract_colon_unit (value, &vptr))
# 916| {
# 917| ind = find_shopt (vname);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/builtins/type.def: scope_hint: In function ‘describe_command’
bash-5.2.26-build/bash-5.2/builtins/type.def:338:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 338 | if (full_path = phash_search (command))
# | ^~~~~~~~~
# 336| if (all == 0 || (dflags & CDESC_FORCE_PATH))
# 337| {
# 338|-> if (full_path = phash_search (command))
# 339| {
# 340| if (dflags & CDESC_TYPE)
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.2.26-build/bash-5.2/builtins/type.def: scope_hint: In function ‘describe_command’
bash-5.2.26-build/bash-5.2/builtins/type.def:410:9: warning[-Wanalyzer-null-argument]: use of NULL ‘full_path’ where non-null expected
bash-5.2.26-build/bash-5.2/shell.h:29: included_from: Included from here.
bash-5.2.26-build/bash-5.2/builtins/type.def:66: included_from: Included from here.
bash-5.2.26-build/bash-5.2/builtins/type.def:374:11: note: in expansion of macro ‘STREQ’
<built-in>: note: argument 1 of ‘__builtin_puts’ must be non-null
# 408| printf (_("%s is %s\n"), command, full_path);
# 409| else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY))
# 410|-> printf ("%s\n", full_path);
# 411|
# 412| free (full_path);
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/builtins/ulimit.def:783:1: warning[-Wunused-function]: ‘set_all_limits’ defined but not used
# 783 | set_all_limits (mode, newlim)
# | ^~~~~~~~~~~~~~
# 781|
# 782| static int
# 783|-> set_all_limits (mode, newlim)
# 784| int mode;
# 785| RLIMTYPE newlim;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/wait.def: scope_hint: In function ‘wait_builtin’
bash-5.2.26-build/bash-5.2/builtins/wait.def:117:14: warning[-Wunused-but-set-variable]: variable ‘pidvar’ set but not used
# 117 | SHELL_VAR *pidvar;
# | ^~~~~~
# 115| volatile int wflags;
# 116| char *vname;
# 117|-> SHELL_VAR *pidvar;
# 118| struct procstat pstat;
# 119|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/builtins/wait.def: scope_hint: In function ‘set_waitlist’
bash-5.2.26-build/bash-5.2/builtins/wait.def:338:12: warning[-Wunused-variable]: unused variable ‘r’
# 338 | int job, r, njob;
# | ^
# 336| {
# 337| sigset_t set, oset;
# 338|-> int job, r, njob;
# 339| intmax_t pid;
# 340| WORD_LIST *l;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/eval.c: scope_hint: In function ‘reader_loop’
bash-5.2.26-build/bash-5.2/eval.c:148:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 148 | else if (current_command = global_command)
# | ^~~~~~~~~~~~~~~
# 146| global_command = (COMMAND *)NULL;
# 147| }
# 148|-> else if (current_command = global_command)
# 149| {
# 150| global_command = (COMMAND *)NULL;
Error: COMPILER_WARNING (CWE-252):
bash-5.2.26-build/bash-5.2/eval.c: scope_hint: In function ‘alrm_catcher’
bash-5.2.26-build/bash-5.2/eval.c:245:3: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 245 | write (1, msg, strlen (msg));
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 243|
# 244| msg = _("\007timed out waiting for input: auto-logout\n");
# 245|-> write (1, msg, strlen (msg));
# 246|
# 247| bash_logout (); /* run ~/.bash_logout if this is a login shell */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/execute_cmd.c:281:12: warning[-Wunused-variable]: ‘connection_count’ defined but not used
# 281 | static int connection_count;
# | ^~~~~~~~~~~~~~~~
# 279| static int showing_function_line;
# 280|
# 281|-> static int connection_count;
# 282|
# 283| /* $LINENO ($BASH_LINENO) for use by an ERR trap. Global so parse_and_execute
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/execute_cmd.c: scope_hint: In function ‘execute_command_internal’
bash-5.2.26-build/bash-5.2/execute_cmd.c:1128:9: warning[-Wmaybe-uninitialized]: ‘ofifo_list’ may be used uninitialized
# 1128 | close_new_fifos ((void *)ofifo_list, osize);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/execute_cmd.c:592:18: note: ‘ofifo_list’ was declared here
# 592 | volatile void *ofifo_list;
# | ^~~~~~~~~~
# 1126| nfifo = num_fifos ();
# 1127| if (nfifo > ofifo)
# 1128|-> close_new_fifos ((void *)ofifo_list, osize);
# 1129| free ((void *)ofifo_list);
# 1130| discard_unwind_frame ("internal_fifos");
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1405: error[uninitvar]: Uninitialized variable: save_top_level
# 1403|
# 1404| old_flags = command->flags;
# 1405|-> COPY_PROCENV (top_level, save_top_level);
# 1406| command->flags &= ~(CMD_TIME_PIPELINE|CMD_TIME_POSIX);
# 1407| code = setjmp_nosigs (top_level);
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/execute_cmd.c:1787:13: warning[-Wunused-function]: ‘cpl_prune’ declared ‘static’ but never defined
# 1787 | static void cpl_prune PARAMS((void));
# | ^~~~~~~~~
# 1785| static struct cpelement *cpl_search PARAMS((pid_t));
# 1786| static struct cpelement *cpl_searchbyname PARAMS((const char *));
# 1787|-> static void cpl_prune PARAMS((void));
# 1788|
# 1789| static void coproc_free PARAMS((struct coproc *));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1818:1: warning[-Wunused-function]: ‘cpl_add’ defined but not used
# 1818 | cpl_add (cp)
# | ^~~~~~~
# 1816|
# 1817| static struct cpelement *
# 1818|-> cpl_add (cp)
# 1819| Coproc *cp;
# 1820| {
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1841:1: warning[-Wunused-function]: ‘cpl_delete’ defined but not used
# 1841 | cpl_delete (pid)
# | ^~~~~~~~~~
# 1839|
# 1840| static struct cpelement *
# 1841|-> cpl_delete (pid)
# 1842| pid_t pid;
# 1843| {
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1874:1: warning[-Wunused-function]: ‘cpl_reap’ defined but not used
# 1874 | cpl_reap ()
# | ^~~~~~~~
# 1872|
# 1873| static void
# 1874|-> cpl_reap ()
# 1875| {
# 1876| struct cpelement *p, *next, *nh, *nt;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1915:1: warning[-Wunused-function]: ‘cpl_flush’ defined but not used
# 1915 | cpl_flush ()
# | ^~~~~~~~~
# 1913| /* Clear out the list of saved statuses */
# 1914| static void
# 1915|-> cpl_flush ()
# 1916| {
# 1917| struct cpelement *cpe, *p;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1933:1: warning[-Wunused-function]: ‘cpl_closeall’ defined but not used
# 1933 | cpl_closeall ()
# | ^~~~~~~~~~~~
# 1931|
# 1932| static void
# 1933|-> cpl_closeall ()
# 1934| {
# 1935| struct cpelement *cpe;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1942:1: warning[-Wunused-function]: ‘cpl_fdchk’ defined but not used
# 1942 | cpl_fdchk (fd)
# | ^~~~~~~~~
# 1940|
# 1941| static void
# 1942|-> cpl_fdchk (fd)
# 1943| int fd;
# 1944| {
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1954:1: warning[-Wunused-function]: ‘cpl_search’ defined but not used
# 1954 | cpl_search (pid)
# | ^~~~~~~~~~
# 1952| found. If not found, return NULL. */
# 1953| static struct cpelement *
# 1954|-> cpl_search (pid)
# 1955| pid_t pid;
# 1956| {
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1968:1: warning[-Wunused-function]: ‘cpl_searchbyname’ defined but not used
# 1968 | cpl_searchbyname (name)
# | ^~~~~~~~~~~~~~~~
# 1966| cpelement struct if found. If not found, return NULL. */
# 1967| static struct cpelement *
# 1968|-> cpl_searchbyname (name)
# 1969| const char *name;
# 1970| {
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:1980:1: warning[-Wunused-function]: ‘cpl_firstactive’ defined but not used
# 1980 | cpl_firstactive ()
# | ^~~~~~~~~~~~~~~
# 1978|
# 1979| static pid_t
# 1980|-> cpl_firstactive ()
# 1981| {
# 1982| struct cpelement *cpe;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/execute_cmd.c:2075:1: warning[-Wunused-function]: ‘coproc_free’ defined but not used
# 2075 | coproc_free (cp)
# | ^~~~~~~~~~~
# 2073|
# 2074| static void
# 2075|-> coproc_free (cp)
# 2076| struct coproc *cp;
# 2077| {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/execute_cmd.c:3204:12: warning[-Wunused-variable]: ‘LINES’ defined but not used
# 3204 | static int LINES, COLS, tabsize;
# | ^~~~~
# 3202|
# 3203| #if defined (SELECT_COMMAND)
# 3204|-> static int LINES, COLS, tabsize;
# 3205|
# 3206| #define RP_SPACE ") "
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/execute_cmd.c: scope_hint: In function ‘select_query’
bash-5.2.26-build/bash-5.2/execute_cmd.c:3341:23: warning[-Wunused-variable]: unused variable ‘t’
# 3341 | char *repl_string, *t;
# | ^
# 3339| intmax_t reply;
# 3340| WORD_LIST *l;
# 3341|-> char *repl_string, *t;
# 3342|
# 3343| COLS = default_columns ();
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘exppower’
bash-5.2.26-build/bash-5.2/expr.c:963:33: warning[-Wunused-variable]: unused variable ‘c’
# 963 | register intmax_t val1, val2, c;
# | ^
# 961| exppower ()
# 962| {
# 963|-> register intmax_t val1, val2, c;
# 964|
# 965| val1 = exp1 ();
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/expr.c:1124:1: warning[-Wunused-function]: ‘alloc_lvalue’ defined but not used
# 1124 | alloc_lvalue ()
# | ^~~~~~~~~~~~
# 1122|
# 1123| static struct lvalue *
# 1124|-> alloc_lvalue ()
# 1125| {
# 1126| struct lvalue *lv;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/expr.c:1134:1: warning[-Wunused-function]: ‘free_lvalue’ defined but not used
# 1134 | free_lvalue (lv)
# | ^~~~~~~~~~~
# 1132|
# 1133| static void
# 1134|-> free_lvalue (lv)
# 1135| struct lvalue *lv;
# 1136| {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘readtok’
bash-5.2.26-build/bash-5.2/expr.c:1316:17: warning[-Wunused-variable]: unused variable ‘lval’
# 1316 | struct lvalue lval;
# | ^~~~
# 1314| register unsigned char c, c1;
# 1315| register int e;
# 1316|-> struct lvalue lval;
# 1317|
# 1318| /* Skip leading whitespace. */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘strlong’
bash-5.2.26-build/bash-5.2/expr.c:1552:17: warning[-Wunused-variable]: unused variable ‘pval’
# 1552 | intmax_t val, pval;
# | ^~~~
# 1550| register unsigned char c;
# 1551| int base, foundbase;
# 1552|-> intmax_t val, pval;
# 1553|
# 1554| s = num;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/findcmd.c: scope_hint: In function ‘_find_user_command_internal’
bash-5.2.26-build/bash-5.2/findcmd.c:269:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 269 | if (var = find_variable_tempenv ("PATH")) /* XXX could be array? */
# | ^~~
# 267| /* Search for the value of PATH in both the temporary environments and
# 268| in the regular list of variables. */
# 269|-> if (var = find_variable_tempenv ("PATH")) /* XXX could be array? */
# 270| path_list = value_cell (var);
# 271| else
Error: CPPCHECK_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/findcmd.c:492: warning[nullPointer]: Possible null pointer dereference: match_list
# 490| }
# 491|
# 492|-> match = match_list[match_index];
# 493|
# 494| if (match)
Error: COMPILER_WARNING (CWE-665):
bash-5.2.26-build/bash-5.2/general.c:91:1: warning[-Wmissing-braces]: missing braces around initializer
# 91 | {
# | ^
# 92 | &interactive_comments,
# | { }
# 93 | &source_uses_path,
# | { }
# 94 | &expaliases_flag,
# | { }
# 95 | &inherit_errexit,
# | { }
# 96 | &print_shift_error,
# | { }
# 97 | 0
# | {
# 98 | };
# | }
# 89| int *posix_mode_var;
# 90| } posix_vars[] =
# 91|-> {
# 92| &interactive_comments,
# 93| &source_uses_path,
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/general.c: scope_hint: In function ‘assignment’
bash-5.2.26-build/bash-5.2/general.c:459:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 459 | while (c = string[indx])
# | ^
# 457| return (0);
# 458|
# 459|-> while (c = string[indx])
# 460| {
# 461| /* The following is safe. Note that '=' at the start of a word
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.2.26-build/bash-5.2/shell.h:29: included_from: Included from here.
bash-5.2.26-build/bash-5.2/expr.c:84: included_from: Included from here.
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘readtok’
bash-5.2.26-build/bash-5.2/general.h:69:54: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
bash-5.2.26-build/bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘readtok’
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘readtok’
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘readtok’
bash-5.2.26-build/bash-5.2/expr.c: scope_hint: In function ‘readtok’
bash-5.2.26-build/bash-5.2/expr.c:93:27: note: in expansion of macro ‘whitespace’
bash-5.2.26-build/bash-5.2/expr.c:1321:30: note: in expansion of macro ‘cr_whitespace’
bash-5.2.26-build/bash-5.2/general.h:172:27: note: in definition of macro ‘FREE’
bash-5.2.26-build/bash-5.2/expr.c:1368:7: note: in expansion of macro ‘FREE’
bash-5.2.26-build/bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/expr.c:1373:7: note: in expansion of macro ‘SAVETOK’
bash-5.2.26-build/bash-5.2/expr.c:1373:7: note: in expansion of macro ‘SAVETOK’
bash-5.2.26-build/bash-5.2/expr.c:1369:16: note: in expansion of macro ‘savestring’
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 67|
# 68| #if !defined (savestring)
# 69|-> # define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
# 70| #endif
# 71|
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.2.26-build/bash-5.2/shell.h:29: included_from: Included from here.
bash-5.2.26-build/bash-5.2/bashline.c:47: included_from: Included from here.
bash-5.2.26-build/bash-5.2/bashline.c: scope_hint: In function ‘bash_directory_expansion’
bash-5.2.26-build/bash-5.2/general.h:69:54: warning[-Wanalyzer-null-argument]: use of NULL ‘dh2’ where non-null expected
bash-5.2.26-build/bash-5.2/bashline.c:3263:7: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/bashline.c:3263:7: note: in expansion of macro ‘savestring’
bash-5.2.26-build/bash-5.2/bashline.c:3263:7: note: in expansion of macro ‘savestring’
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 67|
# 68| #if !defined (savestring)
# 69|-> # define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
# 70| #endif
# 71|
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.2.26-build/bash-5.2/shell.h:29: included_from: Included from here.
bash-5.2.26-build/bash-5.2/make_cmd.c:37: included_from: Included from here.
bash-5.2.26-build/bash-5.2/make_cmd.c: scope_hint: In function ‘make_here_document’
bash-5.2.26-build/bash-5.2/general.h:152:30: warning[-Wanalyzer-null-argument]: use of NULL ‘document’ where non-null expected
bash-5.2.26-build/bash-5.2/make_cmd.c:665:7: note: in expansion of macro ‘FASTCOPY’
bash-5.2.26-build/bash-5.2/make_cmd.c:665:7: note: in expansion of macro ‘FASTCOPY’
bash-5.2.26-build/bash-5.2/general.h:152:49: note: in definition of macro ‘FASTCOPY’
bash-5.2.26-build/bash-5.2/make_cmd.c:665:7: note: in expansion of macro ‘FASTCOPY’
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
# 150|
# 151| #if __GNUC__ > 1
# 152|-> # define FASTCOPY(s, d, n) __builtin_memcpy ((d), (s), (n))
# 153| #else /* !__GNUC__ */
# 154| # if !defined (HAVE_BCOPY)
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/general.h:168:41: warning[-Wuse-after-free]: pointer ‘nestret_426’ may be used after ‘free’
# 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# | ~~~^~~
bash-5.2.26-build/bash-5.2/parse.y:3902:19: note: call to ‘free’ here
# 3902 | free (nestret);
# | ^~~~~~~~~~~~~~
# 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
# 167| #define STREQN(a, b, n) ((n == 0) ? (1) \
# 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# 169|
# 170| /* More convenience definitions that possibly save system or libc calls. */
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/general.h:168:41: warning[-Wuse-after-free]: pointer ‘t_408’ may be used after ‘free’
# 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# | ~~~^~~
bash-5.2.26-build/bash-5.2/subst.c:4290:15: note: call to ‘free’ here
# 4290 | free (t);
# | ^~~~~~~~
# 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
# 167| #define STREQN(a, b, n) ((n == 0) ? (1) \
# 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# 169|
# 170| /* More convenience definitions that possibly save system or libc calls. */
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/general.h:168:41: warning[-Wuse-after-free]: pointer ‘ttok_1105’ may be used after ‘free’
# 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# | ~~~^~~
bash-5.2.26-build/bash-5.2/parse.y:5099:19: note: call to ‘free’ here
# 5099 | free (ttok);
# | ^~~~~~~~~~~
# 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
# 167| #define STREQN(a, b, n) ((n == 0) ? (1) \
# 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# 169|
# 170| /* More convenience definitions that possibly save system or libc calls. */
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_matched_pair’
bash-5.2.26-build/bash-5.2/general.h:168:58: warning[-Wuse-after-free]: pointer ‘nestret_426’ may be used after ‘free’
# 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# | ^~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/parse.y:3902:19: note: call to ‘free’ here
# 3902 | free (nestret);
# | ^~~~~~~~~~~~~~
# 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
# 167| #define STREQN(a, b, n) ((n == 0) ? (1) \
# 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# 169|
# 170| /* More convenience definitions that possibly save system or libc calls. */
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/shell.h:29: included_from: Included from here.
bash-5.2.26-build/bash-5.2/subst.c:46: included_from: Included from here.
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘expand_string_dollar_quote’
bash-5.2.26-build/bash-5.2/general.h:168:58: warning[-Wuse-after-free]: pointer ‘t_408’ may be used after ‘free’
# 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# | ^~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/subst.c:4290:15: note: call to ‘free’ here
# 4290 | free (t);
# | ^~~~~~~~
# 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
# 167| #define STREQN(a, b, n) ((n == 0) ? (1) \
# 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# 169|
# 170| /* More convenience definitions that possibly save system or libc calls. */
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/shell.h:29: included_from: Included from here.
bash-5.2.26-build/bash-5.2/parse.y:47: included_from: Included from here.
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘read_token_word’
bash-5.2.26-build/bash-5.2/general.h:168:58: warning[-Wuse-after-free]: pointer ‘ttok_1105’ may be used after ‘free’
# 168 | : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# | ^~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/parse.y:5099:19: note: call to ‘free’ here
# 5099 | free (ttok);
# | ^~~~~~~~~~~
# 166| #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
# 167| #define STREQN(a, b, n) ((n == 0) ? (1) \
# 168|-> : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
# 169|
# 170| /* More convenience definitions that possibly save system or libc calls. */
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_expand_length’
bash-5.2.26-build/bash-5.2/general.h:171:78: warning[-Wmaybe-uninitialized]: ‘t’ may be used uninitialized
# 171 | #define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
bash-5.2.26-build/bash-5.2/subst.c:7990:9: note: ‘t’ was declared here
# 7990 | char *t, *newname;
# | ^
# 169|
# 170| /* More convenience definitions that possibly save system or libc calls. */
# 171|-> #define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
# 172| #define FREE(s) do { if (s) free (s); } while (0)
# 173| #define MEMBER(c, s) (((c) && c == (s)[0] && !(s)[1]) || (member(c, s)))
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/hashlib.c:169:1: warning[-Wunused-function]: ‘hash_shrink’ defined but not used
# 169 | hash_shrink (table)
# | ^~~~~~~~~~~
# 167|
# 168| static void
# 169|-> hash_shrink (table)
# 170| HASH_TABLE *table;
# 171| {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘procsub_waitall’
bash-5.2.26-build/bash-5.2/jobs.c:1103:7: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used
# 1103 | int r;
# | ^
# 1101| {
# 1102| PROCESS *p;
# 1103|-> int r;
# 1104|
# 1105| for (p = procsubs.head; p; p = p->next)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c:1136:20: warning[-Wunused-but-set-variable]: variable ‘oend’ set but not used
# 1136 | PROCESS *ohead, *oend, *ps, *p;
# | ^~~~
# 1134| procsub_prune ()
# 1135| {
# 1136|-> PROCESS *ohead, *oend, *ps, *p;
# 1137| int onproc;
# 1138|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘procsub_prune’
bash-5.2.26-build/bash-5.2/jobs.c:1137:7: warning[-Wunused-but-set-variable]: variable ‘onproc’ set but not used
# 1137 | int onproc;
# | ^~~~~~
# 1135| {
# 1136| PROCESS *ohead, *oend, *ps, *p;
# 1137|-> int onproc;
# 1138|
# 1139| if (procsubs.nproc == 0)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘cleanup_dead_jobs’
bash-5.2.26-build/bash-5.2/jobs.c:1214:12: warning[-Wunused-variable]: unused variable ‘discard’
# 1214 | PROCESS *discard;
# | ^~~~~~~
# 1212| register int i;
# 1213| int os;
# 1214|-> PROCESS *discard;
# 1215|
# 1216| if (js.j_jobslots == 0 || jobs_list_frozen)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘nohup_job’
bash-5.2.26-build/bash-5.2/jobs.c:1457:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1457 | if (temp = jobs[job_index])
# | ^~~~
# 1455| return;
# 1456|
# 1457|-> if (temp = jobs[job_index])
# 1458| temp->flags |= J_NOHUP;
# 1459| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c:2126:23: warning[-Wunused-variable]: unused variable ‘termset’
# 2126 | sigset_t set, oset, termset, chldset, oset_copy;
# | ^~~~~~~
# 2124| {
# 2125| int async_p, forksleep;
# 2126|-> sigset_t set, oset, termset, chldset, oset_copy;
# 2127| pid_t pid;
# 2128| SigHandler *oterm;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘make_child’
bash-5.2.26-build/bash-5.2/jobs.c:2126:32: warning[-Wunused-variable]: unused variable ‘chldset’
# 2126 | sigset_t set, oset, termset, chldset, oset_copy;
# | ^~~~~~~
# 2124| {
# 2125| int async_p, forksleep;
# 2126|-> sigset_t set, oset, termset, chldset, oset_copy;
# 2127| pid_t pid;
# 2128| SigHandler *oterm;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘make_child’
bash-5.2.26-build/bash-5.2/jobs.c:2186:7: warning[-Wmaybe-uninitialized]: ‘oterm’ may be used uninitialized
# 2186 | set_signal_handler (SIGTERM, oterm);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/jobs.c:2128:15: note: ‘oterm’ was declared here
# 2128 | SigHandler *oterm;
# | ^~~~~
# 2184| if (pid != 0)
# 2185| if (interactive_shell)
# 2186|-> set_signal_handler (SIGTERM, oterm);
# 2187|
# 2188| if (pid < 0)
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/jobs.c:2575:11: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘notify_of_job_status.part.0’
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘notify_of_job_status.part.0’
# 2573| p = find_last_proc (job, block);
# 2574| /* Possible race condition here. */
# 2575|-> return p->pid;
# 2576| }
# 2577|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘wait_for_background_pids’
bash-5.2.26-build/bash-5.2/jobs.c:2652:20: warning[-Wunused-but-set-variable]: variable ‘check_async’ set but not used
# 2652 | int any_stopped, check_async, njobs;
# | ^~~~~~~~~~~
# 2650| {
# 2651| register int i, r;
# 2652|-> int any_stopped, check_async, njobs;
# 2653| sigset_t set, oset;
# 2654| pid_t pid;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/jobs.c: scope_hint: In function ‘sigchld_handler’
bash-5.2.26-build/bash-5.2/jobs.c:3749:7: warning[-Wunused-but-set-variable]: variable ‘n’ set but not used
# 3749 | int n, oerrno;
# | ^
# 3747| int sig;
# 3748| {
# 3749|-> int n, oerrno;
# 3750|
# 3751| oerrno = errno;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:204:27: warning[-Wunused-but-set-variable]: variable ‘nullpat’ set but not used
# 204 | int n, r, negate, wild, nullpat, xflags;
# | ^~~~~~~
# 202| {
# 203| char *pp, *pe, *t, *se;
# 204|-> int n, r, negate, wild, nullpat, xflags;
# 205|
# 206| negate = *pat == '!';
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘extglob_skipname’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:237:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 237 | while (t = glob_patscan (pp, pe, '|'))
# | ^
# 235|
# 236| /* check every subpattern */
# 237|-> while (t = glob_patscan (pp, pe, '|'))
# 238| {
# 239| /* If T == PE and *T == 0 (&& PE[-1] == RPAREN), we have hit the end
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:257:12: warning[-Wmaybe-uninitialized]: ‘r’ may be used uninitialized
# 257 | return r;
# | ^
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘skipname.isra.0’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:204:10: note: ‘r’ was declared here
# 204 | int n, r, negate, wild, nullpat, xflags;
# | ^
# 255| /* glob_patscan might find end of string */
# 256| if (pp == se)
# 257|-> return r;
# 258|
# 259| /* but if it doesn't then we didn't match a leading dot */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘skipname’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:275:7: warning[-Wunused-variable]: unused variable ‘i’
# 275 | int i;
# | ^
# 273| int flags;
# 274| {
# 275|-> int i;
# 276|
# 277| #if EXTENDED_GLOB
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘wskipname’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:317:7: warning[-Wunused-variable]: unused variable ‘i’
# 317 | int i;
# | ^
# 315| int flags;
# 316| {
# 317|-> int i;
# 318|
# 319| if (glob_always_skip_dot_and_dotdot && WDOT_OR_DOTDOT (dname))
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:355:24: warning[-Wunused-but-set-variable]: variable ‘nullpat’ set but not used
# 355 | int r, negate, wild, nullpat, xflags;
# | ^~~~~~~
# 353| #if EXTENDED_GLOB
# 354| wchar_t *pp, *pe, *t, *se, n;
# 355|-> int r, negate, wild, nullpat, xflags;
# 356|
# 357| negate = *pat == L'!';
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘wextglob_skipname’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:385:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 385 | while (t = glob_patscan_wc (pp, pe, '|'))
# | ^
# 383|
# 384| /* check every subpattern */
# 385|-> while (t = glob_patscan_wc (pp, pe, '|'))
# 386| {
# 387| n = t[-1]; /* ( */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:503:7: warning[-Wunused-variable]: unused variable ‘i’
# 503 | int i, j;
# | ^
# 501| size_t len, n;
# 502| wchar_t *wpathname;
# 503|-> int i, j;
# 504| wchar_t *orig_wpathname;
# 505|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘wdequote_pathname’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:503:10: warning[-Wunused-variable]: unused variable ‘j’
# 503 | int i, j;
# | ^
# 501| size_t len, n;
# 502| wchar_t *wpathname;
# 503|-> int i, j;
# 504| wchar_t *orig_wpathname;
# 505|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘finddirs’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:606:14: warning[-Wunused-variable]: unused variable ‘n’
# 606 | char **r, *n;
# | ^
# 604| int *np;
# 605| {
# 606|-> char **r, *n;
# 607| int ndirs;
# 608| struct globval *ret, *e, *g;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c: scope_hint: In function ‘glob_filename’
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:1339:19: warning[-Wunused-variable]: unused variable ‘dlen’
# 1339 | int dlen;
# | ^~~~
# 1337| if (all_starstar && (dflags & GX_NULLDIR) == 0)
# 1338| {
# 1339|-> int dlen;
# 1340|
# 1341| /* If we have a directory name that is not null (GX_NULLDIR above)
Error: CPPCHECK_WARNING (CWE-758):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:1425: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index.
# 1423| array = glob_dir_to_array (directories[i], temp_results, flags);
# 1424| l = 0;
# 1425|-> while (array[l] != NULL)
# 1426| ++l;
# 1427|
Error: CPPCHECK_WARNING (CWE-758):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:1432: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index.
# 1430| if (new_result == NULL)
# 1431| {
# 1432|-> for (l = 0; array[l]; ++l)
# 1433| free (array[l]);
# 1434| free ((char *)array);
Error: CPPCHECK_WARNING (CWE-758):
bash-5.2.26-build/bash-5.2/lib/glob/glob.c:1433: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index.
# 1431| {
# 1432| for (l = 0; array[l]; ++l)
# 1433|-> free (array[l]);
# 1434| free ((char *)array);
# 1435| goto memory_error;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/gm_loop.c:79:25: warning[-Wunused-variable]: unused variable ‘t’
# 79 | int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
# | ^
# 77| {
# 78| CHAR c;
# 79|-> int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
# 80|
# 81| if (*pat == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/glob/gmisc.c:57: included_from: Included from here.
bash-5.2.26-build/bash-5.2/lib/glob/gm_loop.c: scope_hint: In function ‘umatchlen’
bash-5.2.26-build/bash-5.2/lib/glob/gm_loop.c:85:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 85 | while (c = *pat++)
# | ^
# 83|
# 84| matlen = in_cclass = in_collsym = in_equiv = 0;
# 85|-> while (c = *pat++)
# 86| {
# 87| switch (c)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:340: included_from: Included from here.
bash-5.2.26-build/bash-5.2/lib/glob/sm_loop.c: scope_hint: In function ‘brackmatch’
bash-5.2.26-build/bash-5.2/lib/glob/sm_loop.c:434:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 434 | if (not = (*p == L('!') || *p == L('^')))
# | ^~~
# 432| expression starting with an unquoted circumflex character produces
# 433| unspecified results. This implementation treats the two identically. */
# 434|-> if (not = (*p == L('!') || *p == L('^')))
# 435| ++p;
# 436|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/glob/sm_loop.c: scope_hint: In function ‘glob_patscan’
bash-5.2.26-build/bash-5.2/lib/glob/sm_loop.c:713:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 713 | for (s = string; c = *s; s++)
# | ^
# 711| return (NULL);
# 712|
# 713|-> for (s = string; c = *s; s++)
# 714| {
# 715| if (s >= end)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/glob/sm_loop.c: scope_hint: In function ‘extmatch’
bash-5.2.26-build/bash-5.2/lib/glob/sm_loop.c:924:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 924 | if (m1 = (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0))
# | ^~
# 922| pnext = PATSCAN (psub, pe, L('|'));
# 923| /* If one of the patterns matches, just bail immediately. */
# 924|-> if (m1 = (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0))
# 925| break;
# 926| if (pnext == prest)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘charcmp’
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:108:7: warning[-Wunused-variable]: unused variable ‘ret’
# 108 | int ret;
# | ^~~
# 106| static char s1[2] = { ' ', '\0' };
# 107| static char s2[2] = { ' ', '\0' };
# 108|-> int ret;
# 109|
# 110| /* Eight bits only. Period. */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘charcmp_wc’
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:396:7: warning[-Wunused-variable]: unused variable ‘r’
# 396 | int r;
# | ^
# 394| static wchar_t s1[2] = { L' ', L'\0' };
# 395| static wchar_t s2[2] = { L' ', L'\0' };
# 396|-> int r;
# 397|
# 398| if (c1 == c2)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘posix_cclass_only’
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:535:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 535 | while (p = strchr (p, '['))
# | ^
# 533|
# 534| p = pattern;
# 535|-> while (p = strchr (p, '['))
# 536| {
# 537| if (p[1] != ':')
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:610:10: warning[-Wunused-variable]: unused variable ‘plen’
# 610 | size_t plen, slen, mplen, mslen;
# | ^~~~
# 608| size_t n;
# 609| wchar_t *wpattern, *wstring;
# 610|-> size_t plen, slen, mplen, mslen;
# 611|
# 612| if (MB_CUR_MAX == 1)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:610:16: warning[-Wunused-variable]: unused variable ‘slen’
# 610 | size_t plen, slen, mplen, mslen;
# | ^~~~
# 608| size_t n;
# 609| wchar_t *wpattern, *wstring;
# 610|-> size_t plen, slen, mplen, mslen;
# 611|
# 612| if (MB_CUR_MAX == 1)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:610:22: warning[-Wunused-variable]: unused variable ‘mplen’
# 610 | size_t plen, slen, mplen, mslen;
# | ^~~~~
# 608| size_t n;
# 609| wchar_t *wpattern, *wstring;
# 610|-> size_t plen, slen, mplen, mslen;
# 611|
# 612| if (MB_CUR_MAX == 1)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c: scope_hint: In function ‘xstrmatch’
bash-5.2.26-build/bash-5.2/lib/glob/smatch.c:610:29: warning[-Wunused-variable]: unused variable ‘mslen’
# 610 | size_t plen, slen, mplen, mslen;
# | ^~~~~
# 608| size_t n;
# 609| wchar_t *wpattern, *wstring;
# 610|-> size_t plen, slen, mplen, mslen;
# 611|
# 612| if (MB_CUR_MAX == 1)
Error: CPPCHECK_WARNING (CWE-456):
bash-5.2.26-build/bash-5.2/lib/glob/xmbsrtowcs.c:94: error[uninitdata]: Memory is allocated but not initialized: wsbuf
# 92| psbuf = *ps;
# 93|
# 94|-> wclength = mbsrtowcs (wsbuf, &mbs, n, &psbuf);
# 95|
# 96| if (wsbuf)
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/lib/glob/xmbsrtowcs.c: scope_hint: In function ‘xdupmbstowcs2’
bash-5.2.26-build/bash-5.2/lib/glob/xmbsrtowcs.c:226:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘wsbuf’
# 224| if (n == 0 && p == 0)
# 225| {
# 226|-> wsbuf[wcnum] = L'\0';
# 227| break;
# 228| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/glob/xmbsrtowcs.c:429:13: warning[-Wunused-variable]: unused variable ‘prev_state’
# 429 | mbstate_t prev_state;
# | ^~~~~~~~~~
# 427| char buf[64], *destptr, *tmp_dest;
# 428| unsigned char uc;
# 429|-> mbstate_t prev_state;
# 430|
# 431| cur_max = MB_CUR_MAX;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/glob/xmbsrtowcs.c: scope_hint: In function ‘xwcsrtombs’
bash-5.2.26-build/bash-5.2/lib/glob/xmbsrtowcs.c:456:1: warning[-Wunused-label]: label ‘handle_byte’ defined but not used
# 456 | handle_byte:
# | ^~~~~~~~~~~
# 454| treat invalid wide character sequences as bytes. This is
# 455| intended to be symmetric with xdupmbstowcs2. */
# 456|-> handle_byte:
# 457| destptr = tmp_dest; /* in case wcrtomb modified it */
# 458| uc = wc;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/bind.c: scope_hint: In function ‘_rl_skip_to_delim’
bash-5.2.26-build/bash-5.2/lib/readline/bind.c:1581:29: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1581 | for (i = start,passc = 0; c = string[i]; i++)
# | ^
# 1579| int i, c, passc;
# 1580|
# 1581|-> for (i = start,passc = 0; c = string[i]; i++)
# 1582| {
# 1583| if (passc)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/bind.c: scope_hint: In function ‘rl_parse_and_bind’
bash-5.2.26-build/bash-5.2/lib/readline/bind.c:1675:11: warning[-Wunused-variable]: unused variable ‘s’
# 1675 | int s;
# | ^
# 1673| {
# 1674| char *var, *value, *e;
# 1675|-> int s;
# 1676|
# 1677| var = string + i;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/bind.c: scope_hint: In function ‘rl_function_dumper’
bash-5.2.26-build/bash-5.2/lib/readline/bind.c:2805:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2805 | for (i = 0; name = names[i]; i++)
# | ^~~~
# 2803| fprintf (rl_outstream, "\n");
# 2804|
# 2805|-> for (i = 0; name = names[i]; i++)
# 2806| {
# 2807| rl_command_func_t *function;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/readline/complete.c: scope_hint: In function ‘print_filename’
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:1043:22: warning[-Wmaybe-uninitialized]: ‘printed_len’ may be used uninitialized
# 1043 | printed_len++;
# | ~~~~~~~~~~~^~
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:936:7: note: ‘printed_len’ was declared here
# 936 | int printed_len, extension_char, slen, tlen;
# | ^~~~~~~~~~~
# 1041| {
# 1042| putc (extension_char, rl_outstream);
# 1043|-> printed_len++;
# 1044| }
# 1045| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/complete.c: scope_hint: In function ‘_rl_find_completion_word’
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:1151:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1151 | while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
# | ^~~~~~~~
# 1149| completion, so use the word break characters to find the
# 1150| substring on which to complete. */
# 1151|-> while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
# 1152| {
# 1153| scan = rl_line_buffer[rl_point];
Error: CPPCHECK_WARNING (CWE-562):
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:1280: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1278| {
# 1279| xfree (matches[i]);
# 1280|-> matches[i] = (char *)&dead_slot;
# 1281| }
# 1282| else
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/complete.c: scope_hint: In function ‘compute_lcd_of_matches’
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:1323:7: warning[-Wunused-variable]: unused variable ‘v’
# 1323 | int v;
# | ^
# 1321| char *dtext; /* dequoted TEXT, if needed */
# 1322| #if defined (HANDLE_MULTIBYTE)
# 1323|-> int v;
# 1324| size_t v1, v2;
# 1325| mbstate_t ps1, ps2;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/complete.c: scope_hint: In function ‘rl_completion_matches’
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:2219:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2219 | while (string = (*entry_function) (text, matches))
# | ^~~~~~
# 2217| match_list[1] = (char *)NULL;
# 2218|
# 2219|-> while (string = (*entry_function) (text, matches))
# 2220| {
# 2221| if (RL_SIG_RECEIVED ())
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/complete.c: scope_hint: In function ‘rl_username_completion_function’
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:2291:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2291 | while (entry = getpwent ())
# | ^~~~~
# 2289|
# 2290| #if defined (HAVE_GETPWENT)
# 2291|-> while (entry = getpwent ())
# 2292| {
# 2293| /* Null usernames should result in all users as possible completions. */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/complete.c: scope_hint: In function ‘rl_menu_complete’
bash-5.2.26-build/bash-5.2/lib/readline/complete.c:2828:25: warning[-Wunused-variable]: unused variable ‘cstate’
# 2828 | static int delimiter, cstate;
# | ^~~~~~
# 2826| static int orig_start, orig_end;
# 2827| static char quote_char;
# 2828|-> static int delimiter, cstate;
# 2829|
# 2830| /* The first time through, we generate the list of matches and set things
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/display.c:767:29: warning[-Wunused-variable]: unused variable ‘n0’
# 767 | int newlines, lpos, temp, n0, num, prompt_lines_estimate;
# | ^~
# 765| int in, out, c, linenum, cursor_linenum;
# 766| int inv_botlin, lb_botlin, lb_linenum, o_cpos;
# 767|-> int newlines, lpos, temp, n0, num, prompt_lines_estimate;
# 768| char *prompt_this_line;
# 769| char cur_face;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/display.c:767:33: warning[-Wunused-but-set-variable]: variable ‘num’ set but not used
# 767 | int newlines, lpos, temp, n0, num, prompt_lines_estimate;
# | ^~~
# 765| int in, out, c, linenum, cursor_linenum;
# 766| int inv_botlin, lb_botlin, lb_linenum, o_cpos;
# 767|-> int newlines, lpos, temp, n0, num, prompt_lines_estimate;
# 768| char *prompt_this_line;
# 769| char cur_face;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/display.c: scope_hint: In function ‘rl_redisplay’
bash-5.2.26-build/bash-5.2/lib/readline/display.c:767:38: warning[-Wunused-but-set-variable]: variable ‘prompt_lines_estimate’ set but not used
# 767 | int newlines, lpos, temp, n0, num, prompt_lines_estimate;
# | ^~~~~~~~~~~~~~~~~~~~~
# 765| int in, out, c, linenum, cursor_linenum;
# 766| int inv_botlin, lb_botlin, lb_linenum, o_cpos;
# 767|-> int newlines, lpos, temp, n0, num, prompt_lines_estimate;
# 768| char *prompt_this_line;
# 769| char cur_face;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/readline/display.c: scope_hint: In function ‘rl_redisplay’
bash-5.2.26-build/bash-5.2/lib/readline/display.c:1147:42: warning[-Wmaybe-uninitialized]: ‘wc_width’ may be used uninitialized
# 1147 | if (_rl_screenwidth < lpos + wc_width)
# | ~~~~~^~~~~~~~~~
bash-5.2.26-build/bash-5.2/lib/readline/display.c:775:7: note: ‘wc_width’ was declared here
# 775 | int wc_width;
# | ^~~~~~~~
# 1145| _rl_wrapped_multicolumn = 0;
# 1146|
# 1147|-> if (_rl_screenwidth < lpos + wc_width)
# 1148| for (i = lpos; i < _rl_screenwidth; i++)
# 1149| {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/display.c:1655:39: warning[-Wunused-variable]: unused variable ‘twidth’
# 1655 | int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
# | ^~~~~~
# 1653| char *ofd, *ols, *oe, *nfd, *nls, *ne;
# 1654| char *ofdf, *nfdf, *olsf, *nlsf;
# 1655|-> int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
# 1656| int current_invis_chars;
# 1657| int col_lendiff, col_temp;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/display.c:1786:19: warning[-Wunused-variable]: unused variable ‘count’
# 1786 | int count, i, j;
# | ^~~~~
# 1784| if (newwidth > 0)
# 1785| {
# 1786|-> int count, i, j;
# 1787| char *optr;
# 1788|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/display.c: scope_hint: In function ‘update_line’
bash-5.2.26-build/bash-5.2/lib/readline/display.c:1787:21: warning[-Wunused-variable]: unused variable ‘optr’
# 1787 | char *optr;
# | ^~~~
# 1785| {
# 1786| int count, i, j;
# 1787|-> char *optr;
# 1788|
# 1789| puts_face (new, new_face, newbytes);
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/display.c: scope_hint: In function ‘rl_forced_update_display’
bash-5.2.26-build/bash-5.2/lib/readline/display.c:2683:18: warning[-Wunused-variable]: unused variable ‘temp’
# 2683 | register char *temp;
# | ^~~~
# 2681| rl_forced_update_display (void)
# 2682| {
# 2683|-> register char *temp;
# 2684|
# 2685| if (visible_line)
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/readline/display.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/readline/display.c:3236:1: warning[-Wunused-function]: ‘insert_some_chars’ defined but not used
# 3236 | insert_some_chars (char *string, int count, int col)
# | ^~~~~~~~~~~~~~~~~
# 3234| /* Insert COUNT characters from STRING to the output stream at column COL. */
# 3235| static void
# 3236|-> insert_some_chars (char *string, int count, int col)
# 3237| {
# 3238| open_some_spaces (col);
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.2.26-build/bash-5.2/lib/readline/funmap.c: scope_hint: In function ‘rl_funmap_names’
bash-5.2.26-build/bash-5.2/lib/readline/funmap.c:271:3: warning[-Wanalyzer-null-argument]: use of NULL ‘result’ where non-null expected
bash-5.2.26-build/bash-5.2/lib/readline/funmap.c:33: included_from: Included from here.
/usr/include/stdlib.h:970:13: note: argument 1 of ‘qsort’ must be non-null
# 269| }
# 270|
# 271|-> qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
# 272| return (result);
# 273| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘get_history_event’
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c:213:25: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 213 | for (local_index = i; c = string[i]; i++)
# | ^
# 211|
# 212| /* Only a closing `?' or a newline delimit a substring search string. */
# 213|-> for (local_index = i; c = string[i]; i++)
# 214| {
# 215| #if defined (HANDLE_MULTIBYTE)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_expand_internal’
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c:682:48: warning[-Wunused-but-set-variable]: variable ‘ws’ set but not used
# 682 | int delimiter, failed, si, l_temp, ws, we;
# | ^~
# 680| {
# 681| char *new_event;
# 682|-> int delimiter, failed, si, l_temp, ws, we;
# 683|
# 684| if (c == 's')
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_arg_extract’
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c:1452:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_arg_extract’
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c:46: included_from: Included from here.
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c:1484:7: note: in expansion of macro ‘member’
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c:1484:7: note: in expansion of macro ‘member’
bash-5.2.26-build/bash-5.2/lib/readline/histexpand.c: scope_hint: In function ‘history_arg_extract’
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 1450| {
# 1451| for (size = 0, i = first; i < last; i++)
# 1452|-> size += strlen (list[i]) + 1;
# 1453| result = (char *)xmalloc (size + 1);
# 1454| result[0] = '\0';
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:187:1: warning[-Wunused-function]: ‘history_backupfile’ defined but not used
# 187 | history_backupfile (const char *filename)
# | ^~~~~~~~~~~~~~~~~~
# 185|
# 186| static char *
# 187|-> history_backupfile (const char *filename)
# 188| {
# 189| const char *fn;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_backupfile’
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:193:15: warning[-Wunused-variable]: unused variable ‘fs’
# 193 | struct stat fs;
# | ^~
# 191| size_t len;
# 192| ssize_t n;
# 193|-> struct stat fs;
# 194|
# 195| fn = filename;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_tempfile’
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:221:15: warning[-Wunused-variable]: unused variable ‘fs’
# 221 | struct stat fs;
# | ^~
# 219| size_t len;
# 220| ssize_t n;
# 221|-> struct stat fs;
# 222| int pid;
# 223|
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:473:1: warning[-Wunused-function]: ‘histfile_backup’ defined but not used
# 473 | histfile_backup (const char *filename, const char *back)
# | ^~~~~~~~~~~~~~~
# 471| (e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
# 472| static int
# 473|-> histfile_backup (const char *filename, const char *back)
# 474| {
# 475| #if defined (HAVE_READLINK)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_truncate_file’
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:521:49: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used
# 521 | int file, chars_read, rv, orig_lines, exists, r;
# | ^
# 519| {
# 520| char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */
# 521|-> int file, chars_read, rv, orig_lines, exists, r;
# 522| struct stat finfo, nfinfo;
# 523| size_t file_size;
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_truncate_file’
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:646:46: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘orig_lines’
# 644| FREE (buffer);
# 645|
# 646|-> history_lines_written_to_file = orig_lines - lines;
# 647|
# 648| if (rv == 0 && filename && tempname)
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_truncate_file’
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:646:46: warning[-Wmaybe-uninitialized]: ‘orig_lines’ may be used uninitialized
# 646 | history_lines_written_to_file = orig_lines - lines;
# | ~~~~~~~~~~~^~~~~~~
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:521:29: note: ‘orig_lines’ was declared here
# 521 | int file, chars_read, rv, orig_lines, exists, r;
# | ^~~~~~~~~~
# 644| FREE (buffer);
# 645|
# 646|-> history_lines_written_to_file = orig_lines - lines;
# 647|
# 648| if (rv == 0 && filename && tempname)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c: scope_hint: In function ‘history_do_write’
bash-5.2.26-build/bash-5.2/lib/readline/histfile.c:683:22: warning[-Wunused-variable]: unused variable ‘nfinfo’
# 683 | struct stat finfo, nfinfo;
# | ^~~~~~
# 681| char *output, *tempname, *histname;
# 682| int file, mode, rv, exists;
# 683|-> struct stat finfo, nfinfo;
# 684| #ifdef HISTORY_USE_MMAP
# 685| size_t cursize;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/history.c: scope_hint: In function ‘add_history’
bash-5.2.26-build/bash-5.2/lib/readline/history.c:286:20: warning[-Wunused-variable]: unused variable ‘i’
# 286 | register int i;
# | ^
# 284| if (history_stifled && (history_length == history_max_entries))
# 285| {
# 286|-> register int i;
# 287|
# 288| /* If the history is stifled, and history_length is zero,
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/history.c: scope_hint: In function ‘remove_history’
bash-5.2.26-build/bash-5.2/lib/readline/history.c:489:16: warning[-Wunused-variable]: unused variable ‘i’
# 489 | register int i;
# | ^
# 487| {
# 488| HIST_ENTRY *return_value;
# 489|-> register int i;
# 490| #if 1
# 491| int nentries;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/histsearch.c: scope_hint: In function ‘_hs_history_patsearch’
bash-5.2.26-build/bash-5.2/lib/readline/histsearch.c:212:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 212 | if (unescaped_backslash = (string[ret] == '\\'))
# | ^~~~~~~~~~~~~~~~~~~
# 210| /* fnmatch is required to reject a pattern that ends with an unescaped
# 211| backslash */
# 212|-> if (unescaped_backslash = (string[ret] == '\\'))
# 213| {
# 214| while (ret > 0 && string[--ret] == '\\')
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/input.c: scope_hint: In function ‘rl_read_key’
bash-5.2.26-build/bash-5.2/lib/readline/input.c:764:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 764 | if (c = _rl_next_macro_key ())
# | ^
# 762| {
# 763| /* If input is coming from a macro, then use that. */
# 764|-> if (c = _rl_next_macro_key ())
# 765| return ((unsigned char)c);
# 766|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/input.c:809:12: warning[-Wunused-variable]: unused variable ‘empty_set’
# 809 | sigset_t empty_set;
# | ^~~~~~~~~
# 807| int fd;
# 808| #if defined (HAVE_PSELECT)
# 809|-> sigset_t empty_set;
# 810| fd_set readfds;
# 811| #endif
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/readline/input.c: scope_hint: In function ‘rl_getc’
bash-5.2.26-build/bash-5.2/lib/readline/input.c:880:1: warning[-Wunused-label]: label ‘handle_error’ defined but not used
# 880 | handle_error:
# | ^~~~~~~~~~~~
# 878| /* fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); */
# 879|
# 880|-> handle_error:
# 881| /* If the error that we received was EINTR, then try again,
# 882| this is simply an interrupted system call to read (). We allow
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/isearch.c: scope_hint: In function ‘_rl_isearch_dispatch’
bash-5.2.26-build/bash-5.2/lib/readline/isearch.c:343:37: warning[-Wunused-variable]: unused variable ‘incr’
# 343 | int n, wstart, wlen, limit, cval, incr;
# | ^~~~
# 341| _rl_isearch_dispatch (_rl_search_cxt *cxt, int c)
# 342| {
# 343|-> int n, wstart, wlen, limit, cval, incr;
# 344| char *paste;
# 345| size_t pastelen;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/isearch.c: scope_hint: In function ‘rl_search_history’
bash-5.2.26-build/bash-5.2/lib/readline/isearch.c:848:7: warning[-Wunused-but-set-variable]: variable ‘c’ set but not used
# 848 | int c, r;
# | ^
# 846| {
# 847| _rl_search_cxt *cxt; /* local for now, but saved globally */
# 848|-> int c, r;
# 849|
# 850| RL_SETSTATE(RL_STATE_ISEARCH);
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/isearch.c: scope_hint: In function ‘_rl_isearch_callback’
bash-5.2.26-build/bash-5.2/lib/readline/isearch.c:885:7: warning[-Wunused-but-set-variable]: variable ‘c’ set but not used
# 885 | int c, r;
# | ^
# 883| _rl_isearch_callback (_rl_search_cxt *cxt)
# 884| {
# 885|-> int c, r;
# 886|
# 887| c = _rl_search_getchar (cxt);
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_backward_kill_word’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:202:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion
# 200|
# 201| if (count < 0)
# 202|-> return (rl_backward_kill_word (-count, key));
# 203| else
# 204| {
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_kill_word’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:225:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion
# 223|
# 224| if (count < 0)
# 225|-> return (rl_kill_word (-count, key));
# 226| else
# 227| {
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_copy_backward_word’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:494:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion
# 492| {
# 493| if (count < 0)
# 494|-> return (rl_copy_backward_word (-count, key));
# 495|
# 496| return (_rl_copy_word_as_kill (count, 1));
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_copy_forward_word’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:503:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion
# 501| {
# 502| if (count < 0)
# 503|-> return (rl_copy_forward_word (-count, key));
# 504|
# 505| return (_rl_copy_word_as_kill (count, -1));
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_vi_yank_pop’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:562:13: warning[-Wunused-variable]: unused variable ‘origpoint’
# 562 | int l, n, origpoint;
# | ^~~~~~~~~
# 560| rl_vi_yank_pop (int count, int key)
# 561| {
# 562|-> int l, n, origpoint;
# 563|
# 564| if (((rl_last_func != rl_vi_yank_pop) && (rl_last_func != rl_vi_put)) ||
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:759:15: warning[-Wunused-variable]: unused variable ‘c’
# 759 | int retval, c;
# | ^
# 757| rl_bracketed_paste_begin (int count, int key)
# 758| {
# 759|-> int retval, c;
# 760| size_t len, cap;
# 761| char *buf;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘rl_bracketed_paste_begin’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:760:15: warning[-Wunused-variable]: unused variable ‘cap’
# 760 | size_t len, cap;
# | ^~~
# 758| {
# 759| int retval, c;
# 760|-> size_t len, cap;
# 761| char *buf;
# 762|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_read_bracketed_paste_prefix’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:777:17: warning[-Wunused-variable]: unused variable ‘j’
# 777 | int key, ind, j;
# | ^
# 775| {
# 776| char pbuf[BRACK_PASTE_SLEN+1], *pbpref;
# 777|-> int key, ind, j;
# 778|
# 779| pbpref = BRACK_PASTE_PREF; /* XXX - debugging */
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_read_bracketed_paste_prefix’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:800:29: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘key’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:46: included_from: Included from here.
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:784:11: note: in expansion of macro ‘RL_ISSTATE’
# 798| while (ind >= 0)
# 799| _rl_unget_char (pbuf[ind--]);
# 800|-> return (key < 0 ? key : 0);
# 801| }
# 802| return (key < 0 ? key : 1);
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_read_bracketed_paste_prefix’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:800:29: warning[-Wmaybe-uninitialized]: ‘key’ may be used uninitialized
# 800 | return (key < 0 ? key : 0);
# | ~~~~~~~~~~~~~~~^~~~
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:777:7: note: ‘key’ was declared here
# 777 | int key, ind, j;
# | ^~~
# 798| while (ind >= 0)
# 799| _rl_unget_char (pbuf[ind--]);
# 800|-> return (key < 0 ? key : 0);
# 801| }
# 802| return (key < 0 ? key : 1);
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/kill.c: scope_hint: In function ‘_rl_bracketed_read_mbstring’
bash-5.2.26-build/bash-5.2/lib/readline/kill.c:849:10: warning[-Wunused-variable]: unused variable ‘r’
# 849 | int c, r;
# | ^
# 847| _rl_bracketed_read_mbstring (char *mb, int mlen)
# 848| {
# 849|-> int c, r;
# 850|
# 851| c = _rl_bracketed_read_key ();
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/readline/mbutil.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/readline/mbutil.c:87:1: warning[-Wunused-function]: ‘_rl_utf8_mblen’ defined but not used
# 87 | _rl_utf8_mblen (const char *s, size_t n)
# | ^~~~~~~~~~~~~~
# 85| at S. Encoding is UTF-8. */
# 86| static int
# 87|-> _rl_utf8_mblen (const char *s, size_t n)
# 88| {
# 89| unsigned char c, c1, c2, c3;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/mbutil.c: scope_hint: In function ‘_rl_find_prev_utf8char’
bash-5.2.26-build/bash-5.2/lib/readline/mbutil.c:247:9: warning[-Wunused-variable]: unused variable ‘s’
# 247 | char *s;
# | ^
# 245| _rl_find_prev_utf8char (char *string, int seed, int find_non_zero)
# 246| {
# 247|-> char *s;
# 248| unsigned char b;
# 249| int save, prev;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/misc.c: scope_hint: In function ‘_rl_free_saved_history_line’
bash-5.2.26-build/bash-5.2/lib/readline/misc.c:385:14: warning[-Wunused-variable]: unused variable ‘orig’
# 385 | UNDO_LIST *orig;
# | ^~~~
# 383| _rl_free_saved_history_line (void)
# 384| {
# 385|-> UNDO_LIST *orig;
# 386|
# 387| if (_rl_saved_line_for_history)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/misc.c: scope_hint: In function ‘_rl_revert_previous_lines’
bash-5.2.26-build/bash-5.2/lib/readline/misc.c:460:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 460 | if (ul = (UNDO_LIST *)entry->data)
# | ^~
# 458| while (entry)
# 459| {
# 460|-> if (ul = (UNDO_LIST *)entry->data)
# 461| {
# 462| if (ul == saved_undo_list)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/misc.c: scope_hint: In function ‘rl_clear_history’
bash-5.2.26-build/bash-5.2/lib/readline/misc.c:520:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 520 | if (ul = (UNDO_LIST *)hent->data)
# | ^~
# 518| {
# 519| hent = hlist[i];
# 520|-> if (ul = (UNDO_LIST *)hent->data)
# 521| {
# 522| if (ul == saved_undo_list)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/nls.c: scope_hint: In function ‘utf8locale’
bash-5.2.26-build/bash-5.2/lib/readline/nls.c:110:10: warning[-Wunused-variable]: unused variable ‘len’
# 110 | size_t len;
# | ^~~
# 108| {
# 109| char *cp;
# 110|-> size_t len;
# 111|
# 112| #if HAVE_LANGINFO_CODESET
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/readline/nls.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/readline/nls.c:286:1: warning[-Wunused-function]: ‘find_codeset’ defined but not used
# 286 | find_codeset (char *name, size_t *lenp)
# | ^~~~~~~~~~~~
# 284| /* Isolate codeset portion of locale specification. */
# 285| static char *
# 286|-> find_codeset (char *name, size_t *lenp)
# 287| {
# 288| char *cp, *language, *result;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/parens.c: scope_hint: In function ‘rl_insert_close’
bash-5.2.26-build/bash-5.2/lib/readline/parens.c:118:36: warning[-Wunused-but-set-variable]: variable ‘ready’ set but not used
# 118 | int orig_point, match_point, ready;
# | ^~~~~
# 116| {
# 117| #if defined (HAVE_SELECT)
# 118|-> int orig_point, match_point, ready;
# 119| struct timeval timer;
# 120| fd_set readfds;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/readline.c:76: included_from: Included from here.
bash-5.2.26-build/bash-5.2/lib/readline/parse-colors.h:44:14: warning[-Wunused-variable]: ‘color_buf’ defined but not used
# 44 | static char *color_buf;
# | ^~~~~~~~~
# 42|
# 43| /* Buffer for color sequences */
# 44|-> static char *color_buf;
# 45|
# 46| #endif /* !_PARSE_COLORS_H_ */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/readline.c:567:21: warning[-Wunused-variable]: unused variable ‘eof_found’
# 567 | static int lastc, eof_found;
# | ^~~~~~~~~
# 565| #endif
# 566| {
# 567|-> static int lastc, eof_found;
# 568| int c, code, lk, r;
# 569|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/readline.c: scope_hint: In function ‘readline_internal_char’
bash-5.2.26-build/bash-5.2/lib/readline/readline.c:568:20: warning[-Wunused-but-set-variable]: variable ‘r’ set but not used
# 568 | int c, code, lk, r;
# | ^
# 566| {
# 567| static int lastc, eof_found;
# 568|-> int c, code, lk, r;
# 569|
# 570| lastc = EOF;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/readline/readline.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/readline/readline.c:1343:1: warning[-Wunused-function]: ‘reset_default_bindings’ defined but not used
# 1343 | reset_default_bindings (void)
# | ^~~~~~~~~~~~~~~~~~~~~~
# 1341| interested in back to rl_insert and read the new ones. */
# 1342| static void
# 1343|-> reset_default_bindings (void)
# 1344| {
# 1345| if (_rl_bind_stty_chars)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/search.c:533:7: warning[-Wunused-but-set-variable]: variable ‘had_saved_line’ set but not used
# 533 | int had_saved_line;
# | ^~~~~~~~~~~~~~
# 531| HIST_ENTRY *temp;
# 532| int ret, oldpos, newcol;
# 533|-> int had_saved_line;
# 534| char *t;
# 535|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/search.c: scope_hint: In function ‘rl_history_search_internal’
bash-5.2.26-build/bash-5.2/lib/readline/search.c:534:9: warning[-Wunused-variable]: unused variable ‘t’
# 534 | char *t;
# | ^
# 532| int ret, oldpos, newcol;
# 533| int had_saved_line;
# 534|-> char *t;
# 535|
# 536| had_saved_line = _rl_saved_line_for_history != 0;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/shell.c:125:13: warning[-Wunused-variable]: ‘putenv_buf1’ defined but not used
# 125 | static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */
# | ^~~~~~~~~~~
# 123| respectively. */
# 124| static char setenv_buf[INT_STRLEN_BOUND (int) + 1];
# 125|-> static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */
# 126| static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */
# 127|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/shell.c:126:13: warning[-Wunused-variable]: ‘putenv_buf2’ defined but not used
# 126 | static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */
# | ^~~~~~~~~~~
# 124| static char setenv_buf[INT_STRLEN_BOUND (int) + 1];
# 125| static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */
# 126|-> static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */
# 127|
# 128| void
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/signals.c: scope_hint: In function ‘rl_set_signals’
bash-5.2.26-build/bash-5.2/lib/readline/signals.c:414:25: warning[-Wunused-variable]: unused variable ‘oset’
# 414 | static sigset_t bset, oset;
# | ^~~~
# 412| #if defined (HAVE_POSIX_SIGNALS)
# 413| static int sigmask_set = 0;
# 414|-> static sigset_t bset, oset;
# 415| #endif
# 416|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/signals.c:625:17: warning[-Wunused-variable]: ‘sigint_set’ defined but not used
# 625 | static sigset_t sigint_set, sigint_oset;
# | ^~~~~~~~~~
# 623|
# 624| #if defined (HAVE_POSIX_SIGNALS)
# 625|-> static sigset_t sigint_set, sigint_oset;
# 626| static sigset_t sigwinch_set, sigwinch_oset;
# 627| #else /* !HAVE_POSIX_SIGNALS */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/signals.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/readline/signals.c:625:29: warning[-Wunused-variable]: ‘sigint_oset’ defined but not used
# 625 | static sigset_t sigint_set, sigint_oset;
# | ^~~~~~~~~~~
# 623|
# 624| #if defined (HAVE_POSIX_SIGNALS)
# 625|-> static sigset_t sigint_set, sigint_oset;
# 626| static sigset_t sigwinch_set, sigwinch_oset;
# 627| #else /* !HAVE_POSIX_SIGNALS */
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/lib/readline/text.c: scope_hint: In function ‘rl_insert_text’
bash-5.2.26-build/bash-5.2/lib/readline/text.c:100:3: warning[-Wstringop-truncation]: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length
# 100 | strncpy (rl_line_buffer + rl_point, string, l);
# | ^
bash-5.2.26-build/bash-5.2/lib/readline/text.c:90:29: note: length computed here
# 90 | l = (string && *string) ? strlen (string) : 0;
# | ^~~~~~~~~~~~~~~
# 98| rl_line_buffer[i + l] = rl_line_buffer[i];
# 99|
# 100|-> strncpy (rl_line_buffer + rl_point, string, l);
# 101|
# 102| /* Remember how to undo this if we aren't undoing something. */
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.2.26-build/bash-5.2/lib/readline/text.c: scope_hint: In function ‘rl_forward_byte’
bash-5.2.26-build/bash-5.2/lib/readline/text.c:396:13: warning[-Wanalyzer-infinite-recursion]: infinite recursion
# 394| {
# 395| if (count < 0)
# 396|-> return (rl_forward_byte (-count, key));
# 397|
# 398| if (count > 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/readline/tilde.c: scope_hint: In function ‘tilde_expand’
bash-5.2.26-build/bash-5.2/lib/readline/tilde.c:195:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 195 | if (result = strchr (string, '~'))
# | ^~~~~~
# 193|
# 194| result_index = result_size = 0;
# 195|-> if (result = strchr (string, '~'))
# 196| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 197| else
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/undo.c: scope_hint: In function ‘rl_free_undo_list’
bash-5.2.26-build/bash-5.2/lib/readline/undo.c:119:14: warning[-Wunused-variable]: unused variable ‘release’
# 119 | UNDO_LIST *release, *orig_list;
# | ^~~~~~~
# 117| rl_free_undo_list (void)
# 118| {
# 119|-> UNDO_LIST *release, *orig_list;
# 120|
# 121| orig_list = rl_undo_list;
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/readline/undo.c:154: warning[uninitvar]: Uninitialized variable: roving
# 152| else
# 153| {
# 154|-> roving->next = c;
# 155| roving = roving->next;
# 156| }
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/lib/readline/util.c: scope_hint: In function ‘_rl_audit_tty’
bash-5.2.26-build/bash-5.2/lib/readline/util.c:555:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd’
# 553| fd = socket (PF_NETLINK, SOCK_RAW, NETLINK_AUDIT);
# 554| if (fd < 0)
# 555|-> return;
# 556| size = strlen (string) + 1;
# 557|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c:104:12: warning[-Wunused-variable]: ‘vi_continued_command’ defined but not used
# 104 | static int vi_continued_command;
# | ^~~~~~~~~~~~~~~~~~~~
# 102| us implicitly into insert mode. Some people want this text to be
# 103| attached to the command so that it is `redoable' with `.'. */
# 104|-> static int vi_continued_command;
# 105| static char *vi_insert_buffer;
# 106| static int vi_insert_buffer_size;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_fword’
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c:622:7: warning[-Wunused-but-set-variable]: variable ‘opoint’ set but not used
# 622 | int opoint;
# | ^~~~~~
# 620| rl_vi_fword (int count, int ignore)
# 621| {
# 622|-> int opoint;
# 623|
# 624| while (count-- && rl_point < (rl_end - 1))
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_domove’
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c:1343:7: warning[-Wunused-variable]: unused variable ‘r’
# 1343 | int r;
# | ^
# 1341| rl_vi_domove (int x, int *ignore)
# 1342| {
# 1343|-> int r;
# 1344| _rl_vimotion_cxt *m;
# 1345|
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_change_char’
bash-5.2.26-build/bash-5.2/lib/readline/vi_mode.c:2069:7: warning[-Wstringop-truncation]: ‘strncpy’ output may be truncated copying 16 bytes from a string of length 16
# 2069 | strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX);
# | ^
# 2067| if (_rl_vi_redoing)
# 2068| {
# 2069|-> strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX);
# 2070| c = (unsigned char)_rl_vi_last_replacement[0]; /* XXX */
# 2071| mb[MB_LEN_MAX] = '\0';
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/casemod.c: scope_hint: In function ‘sh_modcase’
bash-5.2.26-build/bash-5.2/lib/sh/casemod.c:107:15: warning[-Wunused-variable]: unused variable ‘c’
# 107 | int inword, c, nc, nop, match, usewords;
# | ^
# 105| {
# 106| int start, next, end, retind;
# 107|-> int inword, c, nc, nop, match, usewords;
# 108| char *ret, *s;
# 109| wchar_t wc;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/sh/eaccess.c:176:1: warning[-Wunused-function]: ‘sh_euidaccess’ defined but not used
# 176 | sh_euidaccess (path, mode)
# | ^~~~~~~~~~~~~
# 174| the effective and real uid and gid as appropriate. */
# 175| static int
# 176|-> sh_euidaccess (path, mode)
# 177| const char *path;
# 178| int mode;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/fnxform.c:49:14: warning[-Wunused-variable]: ‘outbuf’ defined but not used
# 49 | static char *outbuf = 0;
# | ^~~~~~
# 47| #define OUTLEN_MAX 4096
# 48|
# 49|-> static char *outbuf = 0;
# 50| static size_t outlen = 0;
# 51|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/fnxform.c:50:15: warning[-Wunused-variable]: ‘outlen’ defined but not used
# 50 | static size_t outlen = 0;
# | ^~~~~~
# 48|
# 49| static char *outbuf = 0;
# 50|-> static size_t outlen = 0;
# 51|
# 52| static char *curencoding PARAMS((void));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/sh/fnxform.c:80:1: warning[-Wunused-function]: ‘init_tofs’ defined but not used
# 80 | init_tofs ()
# | ^~~~~~~~~
# 78|
# 79| static void
# 80|-> init_tofs ()
# 81| {
# 82| char *cur;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/sh/fnxform.c:89:1: warning[-Wunused-function]: ‘init_fromfs’ defined but not used
# 89 | init_fromfs ()
# | ^~~~~~~~~~~
# 87|
# 88| static void
# 89|-> init_fromfs ()
# 90| {
# 91| char *cur;
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/lib/sh/getenv.c: scope_hint: In function ‘getenv’
bash-5.2.26-build/bash-5.2/lib/sh/getenv.c:55:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘name’ compared to NULL
# 55 | if (name == 0 || *name == '\0')
# | ^
# 53| SHELL_VAR *var;
# 54|
# 55|-> if (name == 0 || *name == '\0')
# 56| return ((char *)NULL);
# 57|
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/lib/sh/getenv.c: scope_hint: In function ‘putenv’
bash-5.2.26-build/bash-5.2/lib/sh/getenv.c:112:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘str’ compared to NULL
# 112 | if (str == 0 || *str == '\0')
# | ^
# 110| int offset;
# 111|
# 112|-> if (str == 0 || *str == '\0')
# 113| {
# 114| errno = EINVAL;
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/lib/sh/getenv.c: scope_hint: In function ‘unsetenv’
bash-5.2.26-build/bash-5.2/lib/sh/getenv.c:214:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘name’ compared to NULL
# 214 | if (name == 0 || *name == '\0' || strchr (name, '=') != 0)
# | ^
# 212| const char *name;
# 213| {
# 214|-> if (name == 0 || *name == '\0' || strchr (name, '=') != 0)
# 215| {
# 216| errno = EINVAL;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/sh/makepath.c: scope_hint: In function ‘sh_makepath’
bash-5.2.26-build/bash-5.2/lib/sh/makepath.c:123:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 123 | while (*r++ = *s++)
# | ^
# 121| *r++ = '/';
# 122| s = xdir;
# 123|-> while (*r++ = *s++)
# 124| ;
# 125| if (xpath != path && xpath != nullpath)
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/sh/netopen.c:267: warning[uninitvar]: Uninitialized variable: s
# 265| break;
# 266| }
# 267|-> return s;
# 268| }
# 269| #endif /* HAVE_GETADDRINFO */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/sh/pathcanon.c: scope_hint: In function ‘sh_canonpath’
bash-5.2.26-build/bash-5.2/lib/sh/pathcanon.c:117:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 117 | if (rooted = ROOTEDPATH(path))
# | ^~~~~~
# 115| /* POSIX.2 says to leave a leading `//' alone. On cygwin, we skip over any
# 116| leading `x:' (dos drive name). */
# 117|-> if (rooted = ROOTEDPATH(path))
# 118| {
# 119| stub_char = DIRSEP;
Error: COMPILER_WARNING (CWE-704):
bash-5.2.26-build/bash-5.2/lib/sh/random.c: scope_hint: In function ‘genseed’
bash-5.2.26-build/bash-5.2/lib/sh/random.c:93:8: warning[-Wpointer-to-int-cast]: cast from pointer to integer of different size
# 91|
# 92| gettimeofday (&tv, NULL);
# 93|-> iv = (u_bits32_t)seedrand; /* let the compiler truncate */
# 94| iv = tv.tv_sec ^ tv.tv_usec ^ getpid () ^ getppid () ^ current_user.uid ^ iv;
# 95| return (iv);
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/sh/random.c:141:1: warning[-Wunused-function]: ‘brand32’ defined but not used
# 141 | brand32 ()
# | ^~~~~~~
# 139| /* Returns a 32-bit pseudo-random number between 0 and 4294967295. */
# 140| static u_bits32_t
# 141|-> brand32 ()
# 142| {
# 143| u_bits32_t ret;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/random.c: scope_hint: In function ‘brand32’
bash-5.2.26-build/bash-5.2/lib/sh/random.c:143:14: warning[-Wunused-variable]: unused variable ‘ret’
# 143 | u_bits32_t ret;
# | ^~~
# 141| brand32 ()
# 142| {
# 143|-> u_bits32_t ret;
# 144|
# 145| rseed32 = intrand32 (rseed32);
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/sh/random.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/sh/random.c:166:1: warning[-Wunused-function]: ‘perturb_rand32’ defined but not used
# 166 | perturb_rand32 ()
# | ^~~~~~~~~~~~~~
# 164|
# 165| static void
# 166|-> perturb_rand32 ()
# 167| {
# 168| rseed32 ^= genseed ();
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/setlinebuf.c:33:14: warning[-Wunused-variable]: ‘stdoutbuf’ defined but not used
# 33 | static char *stdoutbuf = 0;
# | ^~~~~~~~~
# 31| #endif
# 32|
# 33|-> static char *stdoutbuf = 0;
# 34| static char *stderrbuf = 0;
# 35|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/setlinebuf.c:34:14: warning[-Wunused-variable]: ‘stderrbuf’ defined but not used
# 34 | static char *stderrbuf = 0;
# | ^~~~~~~~~
# 32|
# 33| static char *stdoutbuf = 0;
# 34|-> static char *stderrbuf = 0;
# 35|
# 36| /* Cause STREAM to buffer lines as opposed to characters or blocks. */
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/sh/spell.c: scope_hint: In function ‘spname’
bash-5.2.26-build/bash-5.2/lib/sh/spell.c:80:44: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘newname[1]’
# 78| {
# 79| /* `.' is rarely the right thing. */
# 80|-> if (oldname[1] == '\0' && newname[1] == '\0' &&
# 81| oldname[0] != '.' && newname[0] == '.')
# 82| return -1;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/sh/spell.c: scope_hint: In function ‘spname’
bash-5.2.26-build/bash-5.2/lib/sh/spell.c:98:22: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 98 | for (p = best; *np = *p++; np++)
# | ^
# 96| * Add to end of newname
# 97| */
# 98|-> for (p = best; *np = *p++; np++)
# 99| ;
# 100| }
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/lib/sh/spell.c: scope_hint: In function ‘mindist’
bash-5.2.26-build/bash-5.2/lib/sh/spell.c:143:11: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*best’
# 141|
# 142| /* Don't return `.' */
# 143|-> if (best[0] == '.' && best[1] == '\0')
# 144| dist = 3;
# 145| return dist;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c: scope_hint: In function ‘strlist_copy’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:134:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:35:27: note: in definition of macro ‘STRDUP’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:134:24: note: in expansion of macro ‘STRDUP’
# 132| {
# 133| for (i = 0; i < sl->list_size; i++)
# 134|-> new->list[i] = STRDUP (sl->list[i]);
# 135| }
# 136| new->list_size = sl->list_size;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c: scope_hint: In function ‘strlist_merge’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:158:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:35:27: note: in definition of macro ‘STRDUP’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:158:19: note: in expansion of macro ‘STRDUP’
# 156| sl = strlist_create (l1 + l2 + 1);
# 157| for (i = n = 0; i < l1; i++, n++)
# 158|-> sl->list[n] = STRDUP (m1->list[i]);
# 159| for (i = 0; i < l2; i++, n++)
# 160| sl->list[n] = STRDUP (m2->list[i]);
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:160:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:35:27: note: in definition of macro ‘STRDUP’
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:160:19: note: in expansion of macro ‘STRDUP’
# 158| sl->list[n] = STRDUP (m1->list[i]);
# 159| for (i = 0; i < l2; i++, n++)
# 160|-> sl->list[n] = STRDUP (m2->list[i]);
# 161| sl->list_len = n;
# 162| sl->list[n] = (char *)NULL;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/lib/sh/stringlist.c:162:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 160| sl->list[n] = STRDUP (m2->list[i]);
# 161| sl->list_len = n;
# 162|-> sl->list[n] = (char *)NULL;
# 163| return (sl);
# 164| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansicstr’
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c:59:7: warning[-Wunused-variable]: unused variable ‘b’
# 59 | int b, mb_cur_max;
# | ^
# 57| unsigned long v;
# 58| size_t clen;
# 59|-> int b, mb_cur_max;
# 60| #if defined (HANDLE_MULTIBYTE)
# 61| wchar_t wc;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansic_quote’
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c:253:17: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 253 | for (s = str; c = *s; s++)
# | ^
# 251| *r++ = '\'';
# 252|
# 253|-> for (s = str; c = *s; s++)
# 254| {
# 255| b = l = 1; /* 1 == add backslash; 0 == no backslash */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansic_wshouldquote’
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c:337:21: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 337 | for (wcs = wcstr; wcc = *wcs; wcs++)
# | ^~~
# 335| mbstowcs (wcstr, string, slen + 1);
# 336|
# 337|-> for (wcs = wcstr; wcc = *wcs; wcs++)
# 338| if (iswprint(wcc) == 0)
# 339| {
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c: scope_hint: In function ‘ansic_shouldquote’
bash-5.2.26-build/bash-5.2/lib/sh/strtrans.c:360:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 360 | for (s = string; c = *s; s++)
# | ^
# 358| return 0;
# 359|
# 360|-> for (s = string; c = *s; s++)
# 361| {
# 362| #if defined (HANDLE_MULTIBYTE)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/strvis.c: scope_hint: In function ‘sh_strvis’
bash-5.2.26-build/bash-5.2/lib/sh/strvis.c:126:17: warning[-Wunused-variable]: unused variable ‘c’
# 126 | unsigned char c;
# | ^
# 124| char *ret;
# 125| size_t retind, retsize;
# 126|-> unsigned char c;
# 127| DECLARE_MBSTATE;
# 128|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/timers.c: scope_hint: In function ‘shtimer_select’
bash-5.2.26-build/bash-5.2/lib/sh/timers.c:185:26: warning[-Wunused-variable]: unused variable ‘prevmask’
# 185 | sigset_t blocked_sigs, prevmask;
# | ^~~~~~~~
# 183| {
# 184| int r, nfd;
# 185|-> sigset_t blocked_sigs, prevmask;
# 186| struct timeval now, tv;
# 187| fd_set readfds;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:61:12: warning[-Wunused-variable]: ‘ntmpfiles’ defined but not used
# 61 | static int ntmpfiles;
# | ^~~~~~~~~
# 59|
# 60| static char *sys_tmpdir = (char *)NULL;
# 61|-> static int ntmpfiles;
# 62| static int tmpnamelen = -1;
# 63| static unsigned long filenum = 1L;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:63:22: warning[-Wunused-variable]: ‘filenum’ defined but not used
# 63 | static unsigned long filenum = 1L;
# | ^~~~~~~
# 61| static int ntmpfiles;
# 62| static int tmpnamelen = -1;
# 63|-> static unsigned long filenum = 1L;
# 64|
# 65| static char *
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:118:1: warning[-Wunused-function]: ‘sh_seedrand’ defined but not used
# 118 | sh_seedrand ()
# | ^~~~~~~~~~~
# 116|
# 117| static void
# 118|-> sh_seedrand ()
# 119| {
# 120| #if HAVE_RANDOM
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:140:15: warning[-Wunused-variable]: unused variable ‘sb’
# 140 | struct stat sb;
# | ^~
# 138| {
# 139| char *filename, *tdir, *lroot;
# 140|-> struct stat sb;
# 141| int r, tdlen;
# 142| static int seeded = 0;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:141:7: warning[-Wunused-variable]: unused variable ‘r’
# 141 | int r, tdlen;
# | ^
# 139| char *filename, *tdir, *lroot;
# 140| struct stat sb;
# 141|-> int r, tdlen;
# 142| static int seeded = 0;
# 143|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:141:10: warning[-Wunused-but-set-variable]: variable ‘tdlen’ set but not used
# 141 | int r, tdlen;
# | ^~~~~
# 139| char *filename, *tdir, *lroot;
# 140| struct stat sb;
# 141|-> int r, tdlen;
# 142| static int seeded = 0;
# 143|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpname’
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:142:14: warning[-Wunused-variable]: unused variable ‘seeded’
# 142 | static int seeded = 0;
# | ^~~~~~
# 140| struct stat sb;
# 141| int r, tdlen;
# 142|-> static int seeded = 0;
# 143|
# 144| filename = (char *)xmalloc (PATH_MAX + 1);
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpfd’
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:196:11: warning[-Wunused-but-set-variable]: variable ‘tdlen’ set but not used
# 196 | int fd, tdlen;
# | ^~~~~
# 194| {
# 195| char *filename, *tdir, *lroot;
# 196|-> int fd, tdlen;
# 197|
# 198| filename = (char *)xmalloc (PATH_MAX + 1);
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:271:7: warning[-Wunused-variable]: unused variable ‘fd’
# 271 | int fd, tdlen;
# | ^~
# 269| {
# 270| char *filename, *tdir, *lroot, *dirname;
# 271|-> int fd, tdlen;
# 272|
# 273| #ifdef USE_MKDTEMP
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpdir’
bash-5.2.26-build/bash-5.2/lib/sh/tmpfile.c:271:11: warning[-Wunused-but-set-variable]: variable ‘tdlen’ set but not used
# 271 | int fd, tdlen;
# | ^~~~~
# 269| {
# 270| char *filename, *tdir, *lroot, *dirname;
# 271|-> int fd, tdlen;
# 272|
# 273| #ifdef USE_MKDTEMP
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/lib/sh/ufuncs.c: scope_hint: In function ‘fsleep’
bash-5.2.26-build/bash-5.2/lib/sh/ufuncs.c:92:26: warning[-Wunused-variable]: unused variable ‘prevmask’
# 92 | sigset_t blocked_sigs, prevmask;
# | ^~~~~~~~
# 90| {
# 91| int e, r;
# 92|-> sigset_t blocked_sigs, prevmask;
# 93| #if defined (HAVE_PSELECT)
# 94| struct timespec ts;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/lib/sh/zgetline.c: scope_hint: In function ‘zgetline’
bash-5.2.26-build/bash-5.2/lib/sh/zgetline.c:115:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
# 113| }
# 114|
# 115|-> line[nr] = c;
# 116| nr++;
# 117|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/lib/tilde/tilde.c: scope_hint: In function ‘tilde_expand’
bash-5.2.26-build/bash-5.2/lib/tilde/tilde.c:195:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 195 | if (result = strchr (string, '~'))
# | ^~~~~~
# 193|
# 194| result_index = result_size = 0;
# 195|-> if (result = strchr (string, '~'))
# 196| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 197| else
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/locale.c: scope_hint: In function ‘reset_locale_vars’
bash-5.2.26-build/bash-5.2/locale.c:363:9: warning[-Wunused-but-set-variable]: variable ‘t’ set but not used
# 363 | char *t, *x;
# | ^
# 361| reset_locale_vars ()
# 362| {
# 363|-> char *t, *x;
# 364| #if defined (HAVE_SETLOCALE)
# 365| if (lang == 0 || *lang == '\0')
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/locale.c: scope_hint: In function ‘locale_isutf8’
bash-5.2.26-build/bash-5.2/locale.c:599:14: warning[-Wunused-variable]: unused variable ‘encoding’
# 599 | char *cp, *encoding;
# | ^~~~~~~~
# 597| char *lspec;
# 598| {
# 599|-> char *cp, *encoding;
# 600|
# 601| #if HAVE_LANGINFO_CODESET
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/shell.h:29: included_from: Included from here.
bash-5.2.26-build/bash-5.2/mailcheck.c:36: included_from: Included from here.
bash-5.2.26-build/bash-5.2/mailcheck.c: scope_hint: In function ‘find_mail_file’
bash-5.2.26-build/bash-5.2/mailcheck.c:121:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mailfiles’
bash-5.2.26-build/bash-5.2/general.h:166:23: note: in definition of macro ‘STREQ’
bash-5.2.26-build/bash-5.2/general.h:166:23: note: in definition of macro ‘STREQ’
bash-5.2.26-build/bash-5.2/general.h:166:23: note: in definition of macro ‘STREQ’
# 119|
# 120| for (i = 0; i < mailfiles_count; i++)
# 121|-> if (STREQ (mailfiles[i]->name, file))
# 122| return i;
# 123|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/mailcheck.c: scope_hint: In function ‘remember_mail_dates’
bash-5.2.26-build/bash-5.2/mailcheck.c:394:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 394 | while (mailfile = extract_colon_unit (mailpaths, &i))
# | ^~~~~~~~
# 392| }
# 393|
# 394|-> while (mailfile = extract_colon_unit (mailpaths, &i))
# 395| {
# 396| mp = parse_mailpath_spec (mailfile);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/mailcheck.c: scope_hint: In function ‘check_mail’
bash-5.2.26-build/bash-5.2/mailcheck.c:468:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 468 | if (temp = expand_string_to_string (message, Q_DOUBLE_QUOTES))
# | ^~~~
# 466| #undef mtime
# 467|
# 468|-> if (temp = expand_string_to_string (message, Q_DOUBLE_QUOTES))
# 469| {
# 470| puts (temp);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/make_cmd.c: scope_hint: In function ‘make_here_document’
bash-5.2.26-build/bash-5.2/make_cmd.c:616:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 616 | while (full_line = read_secondary_line (delim_unquoted))
# | ^~~~~~~~~
# 614| be read verbatim from the input. If it was not quoted, we
# 615| need to perform backslash-quoted newline removal. */
# 616|-> while (full_line = read_secondary_line (delim_unquoted))
# 617| {
# 618| register char *line;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y:315:12: warning[-Wunused-variable]: ‘global_extglob’ defined but not used
# 315 | static int global_extglob;
# | ^~~~~~~~~~~~~~
# 313| static int two_tokens_ago;
# 314|
# 315|-> static int global_extglob;
# 316|
# 317| /* The line number in a script where the word in a `case WORD', `select WORD'
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y:334:14: warning[-Wunused-variable]: ‘yyoutstream’ defined but not used
# 334 | static FILE *yyoutstream;
# | ^~~~~~~~~~~
# 332| static REDIRECTEE redir;
# 333|
# 334|-> static FILE *yyoutstream;
# 335| static FILE *yyerrstream;
# 336| %}
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y:335:14: warning[-Wunused-variable]: ‘yyerrstream’ defined but not used
# 335 | static FILE *yyerrstream;
# | ^~~~~~~~~~~
# 333|
# 334| static FILE *yyoutstream;
# 335|-> static FILE *yyerrstream;
# 336| %}
# 337|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y:2175:7: warning[-Wunused-variable]: unused variable ‘n’
# 2175 | int n, c;
# | ^
# 2173| {
# 2174| char *ret;
# 2175|-> int n, c;
# 2176|
# 2177| prompt_string_pointer = &ps2_prompt;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘read_secondary_line’
bash-5.2.26-build/bash-5.2/parse.y:2175:10: warning[-Wunused-variable]: unused variable ‘c’
# 2175 | int n, c;
# | ^
# 2173| {
# 2174| char *ret;
# 2175|-> int n, c;
# 2176|
# 2177| prompt_string_pointer = &ps2_prompt;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_matched_pair’
bash-5.2.26-build/bash-5.2/parse.y:3680:18: warning[-Wunused-but-set-variable]: variable ‘prevch’ set but not used
# 3680 | int count, ch, prevch, tflags;
# | ^~~~~~
# 3678| int *lenp, flags;
# 3679| {
# 3680|-> int count, ch, prevch, tflags;
# 3681| int nestlen, ttranslen, start_lineno;
# 3682| char *ret, *nestret, *ttrans;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_comsub’
bash-5.2.26-build/bash-5.2/parse.y:4089:7: warning[-Wunused-but-set-variable]: variable ‘start_lineno’ set but not used
# 4089 | int start_lineno, local_extglob, was_extpat;
# | ^~~~~~~~~~~~
# 4087| {
# 4088| int peekc, r;
# 4089|-> int start_lineno, local_extglob, was_extpat;
# 4090| char *ret, *tcmd;
# 4091| int retlen;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_comsub.constprop.0’
bash-5.2.26-build/bash-5.2/parse.y:4165:19: warning[-Wmaybe-uninitialized]: ‘local_extglob’ may be used uninitialized
# 4165 | extended_glob = local_extglob;
# | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/parse.y:4089:21: note: ‘local_extglob’ was declared here
# 4089 | int start_lineno, local_extglob, was_extpat;
# | ^~~~~~~~~~~~~
# 4163| #if defined (EXTENDED_GLOB)
# 4164| if (shell_compatibility_level <= 51 && was_extpat == 0)
# 4165|-> extended_glob = local_extglob;
# 4166| #endif
# 4167|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘xparse_dolparen’
bash-5.2.26-build/bash-5.2/parse.y:4256:7: warning[-Wunused-but-set-variable]: variable ‘orig_ind’ set but not used
# 4256 | int orig_ind, nc, sflags, start_lineno, local_extglob;
# | ^~~~~~~~
# 4254| sh_parser_state_t ps;
# 4255| sh_input_line_state_t ls;
# 4256|-> int orig_ind, nc, sflags, start_lineno, local_extglob;
# 4257| char *ret, *ep, *ostring;
# 4258|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_string_to_command’
bash-5.2.26-build/bash-5.2/parse.y:4395:9: warning[-Wunused-variable]: unused variable ‘ret’
# 4395 | char *ret, *ep;
# | ^~~
# 4393| int nc, sflags;
# 4394| size_t slen;
# 4395|-> char *ret, *ep;
# 4396| COMMAND *cmd;
# 4397|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_dparen’
bash-5.2.26-build/bash-5.2/parse.y:4461:15: warning[-Wunused-but-set-variable]: variable ‘sline’ set but not used
# 4461 | int cmdtyp, sline;
# | ^~~~~
# 4459| int c;
# 4460| {
# 4461|-> int cmdtyp, sline;
# 4462| char *wval;
# 4463| WORD_DESC *wd;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_arith_cmd’
bash-5.2.26-build/bash-5.2/parse.y:4524:7: warning[-Wunused-but-set-variable]: variable ‘exp_lineno’ set but not used
# 4524 | int exp_lineno, rval, c;
# | ^~~~~~~~~~
# 4522| int adddq;
# 4523| {
# 4524|-> int exp_lineno, rval, c;
# 4525| char *ttok, *tokstr;
# 4526| int ttoklen;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘cond_error’
bash-5.2.26-build/bash-5.2/parse.y:4579:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4579 | if (etext = error_token_from_token (cond_token))
# | ^~~~~
# 4577| else if (cond_token != COND_ERROR)
# 4578| {
# 4579|-> if (etext = error_token_from_token (cond_token))
# 4580| {
# 4581| parser_error (cond_lineno, _("syntax error in conditional expression: unexpected token `%s'"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘cond_term’
bash-5.2.26-build/bash-5.2/parse.y:4661:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4661 | if (etext = error_token_from_token (cond_token))
# | ^~~~~
# 4659| if (term)
# 4660| dispose_cond_node (term); /* ( */
# 4661|-> if (etext = error_token_from_token (cond_token))
# 4662| {
# 4663| parser_error (lineno, _("unexpected token `%s', expected `)'"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y:4693:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4693 | if (etext = error_token_from_token (tok))
# | ^~~~~
# 4691| {
# 4692| dispose_word (op);
# 4693|-> if (etext = error_token_from_token (tok))
# 4694| {
# 4695| parser_error (line_number, _("unexpected argument `%s' to conditional unary operator"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y:4744:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4744 | if (etext = error_token_from_token (tok))
# | ^~~~~
# 4742| else
# 4743| {
# 4744|-> if (etext = error_token_from_token (tok))
# 4745| {
# 4746| parser_error (line_number, _("unexpected token `%s', conditional binary operator expected"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y:4775:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4775 | if (etext = error_token_from_token (tok))
# | ^~~~~
# 4773| else
# 4774| {
# 4775|-> if (etext = error_token_from_token (tok))
# 4776| {
# 4777| parser_error (line_number, _("unexpected argument `%s' to conditional binary operator"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y:4793:16: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4793 | else if (etext = error_token_from_token (tok))
# | ^~~~~
# 4791| if (tok < 256)
# 4792| parser_error (line_number, _("unexpected token `%c' in conditional command"), tok);
# 4793|-> else if (etext = error_token_from_token (tok))
# 4794| {
# 4795| parser_error (line_number, _("unexpected token `%s' in conditional command"), etext);
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/parse.y:4802: error[legacyUninitvar]: Uninitialized variable: term
# 4800| COND_RETURN_ERROR ();
# 4801| }
# 4802|-> return (term);
# 4803| }
# 4804|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘decode_prompt_string’
bash-5.2.26-build/bash-5.2/parse.y:5722:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5722 | while (c = *string++)
# | ^
# 5720| orig_string = string;
# 5721|
# 5722|-> while (c = *string++)
# 5723| {
# 5724| if (posixly_correct && c == '!')
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘error_token_from_token’
bash-5.2.26-build/bash-5.2/parse.y:6138:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6138 | if (t = find_token_in_alist (tok, word_token_alist, 0))
# | ^
# 6136| char *t;
# 6137|
# 6138|-> if (t = find_token_in_alist (tok, word_token_alist, 0))
# 6139| return t;
# 6140|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y:6141:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6141 | if (t = find_token_in_alist (tok, other_token_alist, 0))
# | ^
# 6139| return t;
# 6140|
# 6141|-> if (t = find_token_in_alist (tok, other_token_alist, 0))
# 6142| return t;
# 6143|
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: At top level
bash-5.2.26-build/bash-5.2/parse.y:6314:1: warning[-Wunused-function]: ‘discard_parser_constructs’ defined but not used
# 6314 | discard_parser_constructs (error_p)
# | ^~~~~~~~~~~~~~~~~~~~~~~~~
# 6312| (dispose_command () will actually free the command.) */
# 6313| static void
# 6314|-> discard_parser_constructs (error_p)
# 6315| int error_p;
# 6316| {
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘parse_string_to_word_list’
bash-5.2.26-build/bash-5.2/parse.y:6417:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6417 | if (ea = expanding_alias ())
# | ^~
# 6415|
# 6416| push_stream (1);
# 6417|-> if (ea = expanding_alias ())
# 6418| parser_save_alias ();
# 6419|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/parse.y: scope_hint: In function ‘restore_parser_state’
bash-5.2.26-build/bash-5.2/parse.y:6638:7: warning[-Wunused-variable]: unused variable ‘i’
# 6638 | int i;
# | ^
# 6636| sh_parser_state_t *ps;
# 6637| {
# 6638|-> int i;
# 6639|
# 6640| if (ps == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/pathexp.c: scope_hint: In function ‘unquoted_glob_pattern_p’
bash-5.2.26-build/bash-5.2/pathexp.c:73:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 73 | while (c = *string++)
# | ^
# 71| send = string + strlen (string);
# 72|
# 73|-> while (c = *string++)
# 74| {
# 75| switch (c)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/pathexp.c: scope_hint: In function ‘shell_glob_filename’
bash-5.2.26-build/bash-5.2/pathexp.c:412:15: warning[-Wunused-variable]: unused variable ‘quoted_pattern’
# 412 | int gflags, quoted_pattern;
# | ^~~~~~~~~~~~~~
# 410| {
# 411| char *temp, **results;
# 412|-> int gflags, quoted_pattern;
# 413|
# 414| noglob_dot_filenames = glob_dot_filenames == 0;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/pathexp.c: scope_hint: In function ‘setup_ignore_patterns’
bash-5.2.26-build/bash-5.2/pathexp.c:620:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 620 | while (colon_bit = split_ignorespec (this_ignoreval, &ptr))
# | ^~~~~~~~~
# 618| while (colon_bit = extract_colon_unit (this_ignoreval, &ptr))
# 619| #else
# 620|-> while (colon_bit = split_ignorespec (this_ignoreval, &ptr))
# 621| #endif
# 622| {
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/print_cmd.c: scope_hint: In function ‘make_command_string_internal’
bash-5.2.26-build/bash-5.2/print_cmd.c:189:14: warning[-Wformat-zero-length]: zero-length gnu_printf format string
# 189 | cprintf ("");
# | ^~
# 187|
# 188| if (command == 0)
# 189|-> cprintf ("");
# 190| else
# 191| {
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/print_cmd.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/print_cmd.c:1004:1: warning[-Wunused-function]: ‘print_heredocs’ defined but not used
# 1004 | print_heredocs (heredocs)
# | ^~~~~~~~~~~~~~
# 1002|
# 1003| static void
# 1004|-> print_heredocs (heredocs)
# 1005| REDIRECT *heredocs;
# 1006| {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/print_cmd.c: scope_hint: In function ‘print_redirection_list’
bash-5.2.26-build/bash-5.2/print_cmd.c:1063:9: warning[-Wunused-variable]: unused variable ‘rw’
# 1063 | char *rw;
# | ^~
# 1061| {
# 1062| REDIRECT *heredocs, *hdtail, *newredir;
# 1063|-> char *rw;
# 1064|
# 1065| heredocs = (REDIRECT *)NULL;
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/redir.c: scope_hint: In function ‘do_redirection_internal’
bash-5.2.26-build/bash-5.2/redir.c:365:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘here_document_to_fd(redirectee, ri)’
# 363| int old;
# 364|
# 365|-> if (redirectee->word == 0 || redirectee->word[0] == '\0')
# 366| {
# 367| if (lenp)
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/redir.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/redir.c:767:1: warning[-Wunused-function]: ‘undoablefd’ defined but not used
# 767 | undoablefd (fd)
# | ^~~~~~~~~~
# 765|
# 766| static int
# 767|-> undoablefd (fd)
# 768| int fd;
# 769| {
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/redir.c:872:23: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘new_redirect’
# 870| /* Set up the variables needed by the rest of the function from the
# 871| new redirection. */
# 872|-> if (new_redirect->instruction == r_err_and_out)
# 873| {
# 874| char *alloca_hack;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/redir.c: scope_hint: In function ‘do_redirection_internal.constprop.0’
bash-5.2.26-build/bash-5.2/redir.c:872:23: warning[-Wmaybe-uninitialized]: ‘new_redirect’ may be used uninitialized
# 872 | if (new_redirect->instruction == r_err_and_out)
# | ~~~~~~~~~~~~^~~~~~~~~~~~~
bash-5.2.26-build/bash-5.2/redir.c:797:13: note: ‘new_redirect’ was declared here
# 797 | REDIRECT *new_redirect;
# | ^~~~~~~~~~~~
# 870| /* Set up the variables needed by the rest of the function from the
# 871| new redirection. */
# 872|-> if (new_redirect->instruction == r_err_and_out)
# 873| {
# 874| char *alloca_hack;
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/redir.c:917:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oflags’
# 915| redirectee_word = redirection_expand (redirectee);
# 916| if (posixly_correct && interactive_shell == 0)
# 917|-> redirectee->flags = oflags;
# 918|
# 919| if (redirectee_word == 0)
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/redir.c:917:27: warning[-Wmaybe-uninitialized]: ‘oflags’ may be used uninitialized
# 917 | redirectee->flags = oflags;
# | ~~~~~~~~~~~~~~~~~~^~~~~~~~
bash-5.2.26-build/bash-5.2/redir.c:793:36: note: ‘oflags’ was declared here
# 793 | int redir_fd, fd, redirector, r, oflags;
# | ^~~~~~
# 915| redirectee_word = redirection_expand (redirectee);
# 916| if (posixly_correct && interactive_shell == 0)
# 917|-> redirectee->flags = oflags;
# 918|
# 919| if (redirectee_word == 0)
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/redir.c:997:39: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(redir_open(redirection_expand(redirectee), *redirect.flags, 438, ri), redirector)’
bash-5.2.26-build/bash-5.2/redir.c: scope_hint: In function ‘do_redirection_internal’
# 995| }
# 996| }
# 997|-> else if ((fd != redirector) && (dup2 (fd, redirector) < 0))
# 998| {
# 999| close (fd); /* dup2 failed? must be fd limit issue */
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/redir.c:1101:41: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(here_document_to_fd(redirectee, ri), redirector)’
# 1099| }
# 1100| }
# 1101|-> else if (fd != redirector && dup2 (fd, redirector) < 0)
# 1102| {
# 1103| r = errno;
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.2.26-build/bash-5.2/redir.c:1177:19: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(redir_fd, redirector)’
# 1175| }
# 1176| /* This is correct. 2>&1 means dup2 (1, 2); */
# 1177|-> else if (dup2 (redir_fd, redirector) < 0)
# 1178| return (errno);
# 1179|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/redir.c: scope_hint: In function ‘redir_varvalue’
bash-5.2.26-build/bash-5.2/redir.c:1485:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1485 | if (vr = valid_array_reference (w, 0))
# | ^~
# 1483| /* XXX - handle set -u here? */
# 1484| #if defined (ARRAY_VARS)
# 1485|-> if (vr = valid_array_reference (w, 0))
# 1486| {
# 1487| v = array_variable_part (w, 0, &sub, &len);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/redir.c:1500:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1500 | if (vr = valid_array_reference (w, 0))
# | ^~
# 1498| {
# 1499| w = nameref_cell (v);
# 1500|-> if (vr = valid_array_reference (w, 0))
# 1501| v = array_variable_part (w, 0, &sub, &len);
# 1502| else
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/shell.c: scope_hint: In function ‘parse_shell_options’
bash-5.2.26-build/bash-5.2/shell.c:928:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 928 | while (arg_character = arg_string[i++])
# | ^~~~~~~~~~~~~
# 926| i = 1;
# 927| on_or_off = arg_string[0];
# 928|-> while (arg_character = arg_string[i++])
# 929| {
# 930| switch (arg_character)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/shell.c: scope_hint: In function ‘disable_priv_mode’
bash-5.2.26-build/bash-5.2/shell.c:1351:7: warning[-Wunused-but-set-variable]: variable ‘e’ set but not used
# 1351 | int e;
# | ^
# 1349| disable_priv_mode ()
# 1350| {
# 1351|-> int e;
# 1352|
# 1353| #if HAVE_SETRESUID
Error: CPPCHECK_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/sig.c:667: error[nullPointer]: Null pointer dereference: (volatile unsigned long*)((void*)0)
# 665|
# 666| if (core)
# 667|-> *((volatile unsigned long *) NULL) = 0xdead0000 + sig; /* SIGSEGV */
# 668|
# 669| exit (128+sig);
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/sig.c: scope_hint: In function ‘kill_shell’
bash-5.2.26-build/bash-5.2/sig.c:667:40: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 665|
# 666| if (core)
# 667|-> *((volatile unsigned long *) NULL) = 0xdead0000 + sig; /* SIGSEGV */
# 668|
# 669| exit (128+sig);
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/stringlib.c: scope_hint: In function ‘strsub’
bash-5.2.26-build/bash-5.2/stringlib.c:163:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘temp’
# 161|
# 162| for (r = rep; *r; ) /* can rep == "" */
# 163|-> temp[templen++] = *r++;
# 164|
# 165| i += patlen ? patlen : 1; /* avoid infinite recursion */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c:222:53: warning[-Wunused-variable]: ‘expand_param_unset’ defined but not used
# 222 | static char expand_param_error, expand_param_fatal, expand_param_unset;
# | ^~~~~~~~~~~~~~~~~~
# 220| static WORD_LIST expand_word_error, expand_word_fatal;
# 221| static WORD_DESC expand_wdesc_error, expand_wdesc_fatal;
# 222|-> static char expand_param_error, expand_param_fatal, expand_param_unset;
# 223| static char extract_string_error, extract_string_fatal;
# 224|
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/subst.c:236:14: warning[-Wunused-function]: ‘quoted_substring’ declared ‘static’ but never defined
# 236 | static char *quoted_substring PARAMS((char *, int, int));
# | ^~~~~~~~~~~~~~~~
# 234| static WORD_LIST *garglist = (WORD_LIST *)NULL;
# 235|
# 236|-> static char *quoted_substring PARAMS((char *, int, int));
# 237| static int quoted_strlen PARAMS((char *));
# 238| static char *quoted_strchr PARAMS((char *, int, int));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:237:12: warning[-Wunused-function]: ‘quoted_strlen’ declared ‘static’ but never defined
# 237 | static int quoted_strlen PARAMS((char *));
# | ^~~~~~~~~~~~~
# 235|
# 236| static char *quoted_substring PARAMS((char *, int, int));
# 237|-> static int quoted_strlen PARAMS((char *));
# 238| static char *quoted_strchr PARAMS((char *, int, int));
# 239|
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:238:14: warning[-Wunused-function]: ‘quoted_strchr’ declared ‘static’ but never defined
# 238 | static char *quoted_strchr PARAMS((char *, int, int));
# | ^~~~~~~~~~~~~
# 236| static char *quoted_substring PARAMS((char *, int, int));
# 237| static int quoted_strlen PARAMS((char *));
# 238|-> static char *quoted_strchr PARAMS((char *, int, int));
# 239|
# 240| static char *expand_string_if_necessary PARAMS((char *, int, EXPFUNC *));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:251:19: warning[-Wunused-function]: ‘list_dequote_escapes’ declared ‘static’ but never defined
# 251 | static WORD_LIST *list_dequote_escapes PARAMS((WORD_LIST *));
# | ^~~~~~~~~~~~~~~~~~~~
# 249|
# 250| static WORD_LIST *list_quote_escapes PARAMS((WORD_LIST *));
# 251|-> static WORD_LIST *list_dequote_escapes PARAMS((WORD_LIST *));
# 252|
# 253| static char *make_quoted_char PARAMS((int));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:256:12: warning[-Wunused-function]: ‘unquoted_substring’ declared ‘static’ but never defined
# 256 | static int unquoted_substring PARAMS((char *, char *));
# | ^~~~~~~~~~~~~~~~~~
# 254| static WORD_LIST *quote_list PARAMS((WORD_LIST *));
# 255|
# 256|-> static int unquoted_substring PARAMS((char *, char *));
# 257| static int unquoted_member PARAMS((int, char *));
# 258|
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:257:12: warning[-Wunused-function]: ‘unquoted_member’ declared ‘static’ but never defined
# 257 | static int unquoted_member PARAMS((int, char *));
# | ^~~~~~~~~~~~~~~
# 255|
# 256| static int unquoted_substring PARAMS((char *, char *));
# 257|-> static int unquoted_member PARAMS((int, char *));
# 258|
# 259| #if defined (ARRAY_VARS)
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:277:23: warning[-Wunused-function]: ‘mb_getcharlens’ declared ‘static’ but never defined
# 277 | static unsigned char *mb_getcharlens PARAMS((char *, int));
# | ^~~~~~~~~~~~~~
# 275| static char *pos_params PARAMS((char *, int, int, int, int));
# 276|
# 277|-> static unsigned char *mb_getcharlens PARAMS((char *, int));
# 278|
# 279| static char *remove_upattern PARAMS((char *, char *, int));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:292:14: warning[-Wunused-function]: ‘variable_remove_pattern’ declared ‘static’ but never defined
# 292 | static char *variable_remove_pattern PARAMS((char *, char *, int, int));
# | ^~~~~~~~~~~~~~~~~~~~~~~
# 290| static int getpatspec PARAMS((int, char *));
# 291| static char *getpattern PARAMS((char *, int, int));
# 292|-> static char *variable_remove_pattern PARAMS((char *, char *, int, int));
# 293| static char *list_remove_pattern PARAMS((WORD_LIST *, char *, int, int, int));
# 294| static char *parameter_list_remove_pattern PARAMS((int, char *, int, int));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c:349:14: warning[-Wunused-function]: ‘pos_params_casemod’ declared ‘static’ but never defined
# 349 | static char *pos_params_casemod PARAMS((char *, char *, int, int));
# | ^~~~~~~~~~~~~~~~~~
# 347| static char *parameter_brace_patsub PARAMS((char *, char *, array_eltstate_t *, char *, int, int, int));
# 348|
# 349|-> static char *pos_params_casemod PARAMS((char *, char *, int, int));
# 350| static char *parameter_brace_casemod PARAMS((char *, char *, array_eltstate_t *, int, char *, int, int, int));
# 351|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘string_extract’
bash-5.2.26-build/bash-5.2/subst.c:810:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 810 | while (c = string[i])
# | ^
# 808| i = *sindex;
# 809| found = 0;
# 810|-> while (c = string[i])
# 811| {
# 812| if (c == '\\')
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘string_extract_double_quoted’
bash-5.2.26-build/bash-5.2/subst.c:884:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 884 | while (c = string[i])
# | ^
# 882| j = 0;
# 883| i = *sindex;
# 884|-> while (c = string[i])
# 885| {
# 886| /* Process a character that was quoted by a backslash. */
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c:1030:9: warning[-Wunused-but-set-variable]: variable ‘ret’ set but not used
# 1030 | char *ret;
# | ^~~
# 1028| {
# 1029| int c, i;
# 1030|-> char *ret;
# 1031| int pass_next, backquote, si;
# 1032| DECLARE_MBSTATE;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘skip_double_quoted’
bash-5.2.26-build/bash-5.2/subst.c:1036:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1036 | while (c = string[i])
# | ^
# 1034| pass_next = backquote = 0;
# 1035| i = sind;
# 1036|-> while (c = string[i])
# 1037| {
# 1038| if (pass_next)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘string_extract_verbatim’
bash-5.2.26-build/bash-5.2/subst.c:1204:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1204 | while (c = string[i])
# | ^
# 1202| wcharlist = 0;
# 1203| #endif
# 1204|-> while (c = string[i])
# 1205| {
# 1206| #if defined (HANDLE_MULTIBYTE)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘extract_delimited_string’
bash-5.2.26-build/bash-5.2/subst.c:1367:9: warning[-Wunused-but-set-variable]: variable ‘t’ set but not used
# 1367 | char *t, *result;
# | ^
# 1365| int i, c, si;
# 1366| size_t slen;
# 1367|-> char *t, *result;
# 1368| int pass_character, nesting_level, in_comment;
# 1369| int len_closer, len_opener, len_alt_opener;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘extract_heredoc_dolbrace_string’
bash-5.2.26-build/bash-5.2/subst.c:1554:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1554 | while (c = string[i])
# | ^
# 1552|
# 1553| i = *sindex;
# 1554|-> while (c = string[i])
# 1555| {
# 1556| if (pass_character)
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘extract_dollar_brace_string’
bash-5.2.26-build/bash-5.2/subst.c:1638:11: warning[-Wstringop-truncation]: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length
# 1638 | strncpy (result + result_index, t, tlen);
# | ^
bash-5.2.26-build/bash-5.2/subst.c:1634:18: note: length computed here
# 1634 | tlen = strlen (t);
# | ^~~~~~~~~~
# 1636|
# 1637| RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 1, result_size, 64);
# 1638|-> strncpy (result + result_index, t, tlen);
# 1639| result_index += tlen;
# 1640| free (t);
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c:1820:18: warning[-Wunused-but-set-variable]: variable ‘t’ set but not used
# 1820 | char *result, *t;
# | ^
# 1818| size_t slen;
# 1819| int pass_character, nesting_level, si, dolbrace_state;
# 1820|-> char *result, *t;
# 1821| DECLARE_MBSTATE;
# 1822|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘extract_dollar_brace_string’
bash-5.2.26-build/bash-5.2/subst.c:1841:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1841 | while (c = string[i])
# | ^
# 1839|
# 1840| i = *sindex;
# 1841|-> while (c = string[i])
# 1842| {
# 1843| if (pass_character)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c:2069:9: warning[-Wunused-but-set-variable]: variable ‘temp’ set but not used
# 2069 | char *temp, *ss;
# | ^~~~
# 2067| int i, pass_next, backq, si, c, count, oldjmp;
# 2068| size_t slen;
# 2069|-> char *temp, *ss;
# 2070| DECLARE_MBSTATE;
# 2071|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘skip_matched_pair’
bash-5.2.26-build/bash-5.2/subst.c:2083:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2083 | while (c = string[i])
# | ^
# 2081| pass_next = backq = 0;
# 2082| ss = (char *)string;
# 2083|-> while (c = string[i])
# 2084| {
# 2085| if (pass_next)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c:2191:9: warning[-Wunused-but-set-variable]: variable ‘temp’ set but not used
# 2191 | char *temp, open[3];
# | ^~~~
# 2189| int arithexp, skipcol;
# 2190| size_t slen;
# 2191|-> char *temp, open[3];
# 2192| DECLARE_MBSTATE;
# 2193|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘skip_to_delim’
bash-5.2.26-build/bash-5.2/subst.c:2208:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2208 | while (c = string[i])
# | ^
# 2206| i = start;
# 2207| pass_next = backq = dquote = 0;
# 2208|-> while (c = string[i])
# 2209| {
# 2210| /* If this is non-zero, we should not let quote characters be delimiters
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘skip_to_histexp’
bash-5.2.26-build/bash-5.2/subst.c:2383:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2383 | while (c = string[i])
# | ^
# 2381| i = start;
# 2382| pass_next = backq = dquote = 0;
# 2383|-> while (c = string[i])
# 2384| {
# 2385| if (pass_next)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘do_assignment_internal’
bash-5.2.26-build/bash-5.2/subst.c:3613:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3613 | if (t = mbschr (name, LBRACK))
# | ^
# 3611|
# 3612| #if defined (ARRAY_VARS)
# 3613|-> if (t = mbschr (name, LBRACK))
# 3614| {
# 3615| if (assign_list)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘expand_string_dollar_quote’
bash-5.2.26-build/bash-5.2/subst.c:4192:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4192 | while (c = string[sindex])
# | ^
# 4190| retind = 0;
# 4191|
# 4192|-> while (c = string[sindex])
# 4193| {
# 4194| switch (c)
Error: CPPCHECK_WARNING (CWE-562):
bash-5.2.26-build/bash-5.2/subst.c:4778: error[returnDanglingLifetime]: Returning pointer to local variable 'result' that will be invalid when returning.
# 4776|
# 4777| if (strchr (string, CTLESC) == 0)
# 4778|-> return (strcpy (result, string));
# 4779|
# 4780| quote_spaces = (ifs_value && *ifs_value == 0);
Error: CPPCHECK_WARNING (CWE-562):
bash-5.2.26-build/bash-5.2/subst.c:4910: error[returnDanglingLifetime]: Returning pointer to local variable 'result' that will be invalid when returning.
# 4908| each character. Just return a copy of the string passed to us. */
# 4909| if (strchr (string, CTLESC) == NULL)
# 4910|-> return (strcpy (result, string));
# 4911|
# 4912| send = string + slen;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘read_comsub’
bash-5.2.26-build/bash-5.2/subst.c:6823:11: warning[-Wmaybe-uninitialized]: ‘bufp’ may be used uninitialized
# 6823 | c = *bufp++;
# | ^~~~~~~
bash-5.2.26-build/bash-5.2/subst.c:6788:40: note: ‘bufp’ was declared here
# 6788 | char *istring, buf[COMSUB_PIPEBUF], *bufp;
# | ^~~~
# 6821| bufp = buf;
# 6822| }
# 6823|-> c = *bufp++;
# 6824|
# 6825| if (c == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_expand_word’
bash-5.2.26-build/bash-5.2/subst.c:7514:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 7514 | else if (var = find_variable (name))
# | ^~~
# 7512| }
# 7513| #endif
# 7514|-> else if (var = find_variable (name))
# 7515| {
# 7516| if (var_isset (var) && invisible_p (var) == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c:7547:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 7547 | else if (var = find_variable_last_nameref (name, 0))
# | ^~~
# 7545| temp = (char *)NULL;
# 7546| }
# 7547|-> else if (var = find_variable_last_nameref (name, 0))
# 7548| {
# 7549| temp = nameref_cell (var);
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_find_indir’
bash-5.2.26-build/bash-5.2/subst.c:7608:33: warning[-Wmaybe-uninitialized]: ‘oldex’ may be used uninitialized
# 7608 | expand_no_split_dollar_star = oldex;
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
bash-5.2.26-build/bash-5.2/subst.c:7589:15: note: ‘oldex’ was declared here
# 7589 | int pflags, oldex;
# | ^~~~~
# 7606| w = parameter_brace_expand_word (name, var_is_special, quoted, pflags, 0);
# 7607| if (var_is_special)
# 7608|-> expand_no_split_dollar_star = oldex;
# 7609|
# 7610| t = w->word;
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/subst.c:7657:31: warning[-Wmaybe-uninitialized]: ‘v’ may be used uninitialized
# 7657 | if (legal_identifier (name) && v == 0)
# | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘param_expand’
bash-5.2.26-build/bash-5.2/subst.c:7635:14: note: ‘v’ was declared here
# 7635 | SHELL_VAR *v;
# | ^
# 7655| ok (currently). Only references to unset variables are errors at this
# 7656| point. */
# 7657|-> if (legal_identifier (name) && v == 0)
# 7658| {
# 7659| report_error (_("%s: invalid indirect expansion"), name);
Error: COMPILER_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/subst.c:8185:48: warning[-Wmaybe-uninitialized]: ‘a’ may be used uninitialized
# 8185 | len = assoc_p (v) ? assoc_num_elements (h) : array_num_elements (a);
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_substring’
bash-5.2.26-build/bash-5.2/subst.c:8123:9: note: ‘a’ was declared here
# 8123 | ARRAY *a;
# | ^
# 8183| /* For arrays, the second offset deals with the number of elements. */
# 8184| if (vtype == VT_ARRAYVAR)
# 8185|-> len = assoc_p (v) ? assoc_num_elements (h) : array_num_elements (a);
# 8186| #endif
# 8187|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘shouldexp_replacement’
bash-5.2.26-build/bash-5.2/subst.c:8903:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 8903 | while (c = s[sindex])
# | ^
# 8901| sindex = 0;
# 8902| slen = STRLEN (s);
# 8903|-> while (c = s[sindex])
# 8904| {
# 8905| if (c == '\\')
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘pat_subst’
bash-5.2.26-build/bash-5.2/subst.c:9036:18: warning[-Wunused-variable]: unused variable ‘clen’
# 9036 | size_t clen;
# | ^~~~
# 9034| we increment one character to avoid infinite recursion. */
# 9035| char *p, *origp, *origs;
# 9036|-> size_t clen;
# 9037|
# 9038| RESIZE_MALLOCED_BUFFER (ret, rptr, locale_mb_cur_max, rsize, 64);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘parameter_brace_expand’
bash-5.2.26-build/bash-5.2/subst.c:9628:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 9628 | if (c = string[sindex])
# | ^
# 9626| /* Find out what character ended the variable name. Then
# 9627| do the appropriate thing. */
# 9628|-> if (c = string[sindex])
# 9629| sindex++;
# 9630|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c:9638:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 9638 | if (c = string[sindex])
# | ^
# 9636| {
# 9637| check_nullness++;
# 9638|-> if (c = string[sindex])
# 9639| sindex++;
# 9640| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c:10981:7: warning[-Wunused-but-set-variable]: variable ‘local_expanded’ set but not used
#10981 | int local_expanded;
# | ^~~~~~~~~~~~~~
#10979| int internal_tilde;
#10980| int split_on_spaces;
#10981|-> int local_expanded;
#10982| int tflag;
#10983| int pflags; /* flags passed to param_expand */
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘expand_word_internal’
bash-5.2.26-build/bash-5.2/subst.c:11655:1: warning[-Wunused-label]: label ‘add_quoted_character’ defined but not used
#11655 | add_quoted_character:
# | ^~~~~~~~~~~~~~~~~~~~
#11653| if ((quoted&(Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0)
#11654| has_quoted_ifs++;
#11655|-> add_quoted_character:
#11656| if (string[sindex]) /* from old goto dollar_add_string */
#11657| sindex++;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘string_quote_removal’
bash-5.2.26-build/bash-5.2/subst.c:11913:29: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
#11913 | for (dquote = sindex = 0; c = string[sindex];)
# | ^
#11911| r = result_string = (char *)xmalloc (slen + 1);
#11912|
#11913|-> for (dquote = sindex = 0; c = string[sindex];)
#11914| {
#11915| switch (c)
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘glob_expand_word_list’
bash-5.2.26-build/bash-5.2/subst.c:12317:7: warning[-Wunused-variable]: unused variable ‘x’
#12317 | int x;
# | ^
#12315| WORD_LIST *glob_list, *output_list, *disposables, *next;
#12316| WORD_DESC *tword;
#12317|-> int x;
#12318|
#12319| output_list = disposables = (WORD_LIST *)NULL;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘brace_expand_word_list’
bash-5.2.26-build/bash-5.2/subst.c:12457:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
#12457 | for (eindex = 0; temp_string = expansions[eindex]; eindex++)
# | ^~~~~~~~~~~
#12455| expansions = brace_expand (tlist->word->word);
#12456|
#12457|-> for (eindex = 0; temp_string = expansions[eindex]; eindex++)
#12458| {
#12459| w = alloc_word_desc ();
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c:12662:28: warning[-Wunused-but-set-variable]: variable ‘inheriting’ set but not used
#12662 | int t, opti, oind, skip, inheriting;
# | ^~~~~~~~~~
#12660| {
#12661| char opts[16], omap[128];
#12662|-> int t, opti, oind, skip, inheriting;
#12663| WORD_LIST *l;
#12664|
Error: COMPILER_WARNING (CWE-823):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘expand_declaration_argument’
bash-5.2.26-build/bash-5.2/subst.c:12718:33: warning[-Wchar-subscripts]: array subscript has type ‘char’
#12718 | omap[l->word->word[oind]] = 1;
# | ~~~~~~~~~~~~~^~~~~~
#12716| case 'u':
#12717| case 'c':
#12718|-> omap[l->word->word[oind]] = 1;
#12719| if (opti == 0)
#12720| opts[opti++] = optchar;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/subst.c: scope_hint: In function ‘expand_word_list_internal’
bash-5.2.26-build/bash-5.2/subst.c:12974:25: warning[-Wunused-variable]: unused variable ‘temp_list’
#12974 | WORD_LIST *new_list, *temp_list;
# | ^~~~~~~~~
#12972| int eflags;
#12973| {
#12974|-> WORD_LIST *new_list, *temp_list;
#12975|
#12976| tempenv_assign_error = 0;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/support/bashversion.c: scope_hint: In function ‘main’
bash-5.2.26-build/bash-5.2/support/bashversion.c:70:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 70 | if (progname = strrchr (argv[0], '/'))
# | ^~~~~~~~
# 68| char dv[128], *rv;
# 69|
# 70|-> if (progname = strrchr (argv[0], '/'))
# 71| progname++;
# 72| else
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:104:13: warning[-Wunused-variable]: ‘location_base’ defined but not used
# 104 | static char location_base[NULL_TERMINATED(MED_STR_MAX)] = "";
# | ^~~~~~~~~~~~~
# 102| #endif
# 103|
# 104|-> static char location_base[NULL_TERMINATED(MED_STR_MAX)] = "";
# 105|
# 106| static char th_page_and_sec[128] = { '\0' };
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/support/man2html.c:148:1: warning[-Wunused-function]: ‘strgrow’ defined but not used
# 148 | strgrow(char *old, int len)
# | ^~~~~~~
# 146|
# 147| static char *
# 148|-> strgrow(char *old, int len)
# 149| {
# 150| char *new = realloc(old, (strlen(old) + len + 1) * sizeof(char));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/support/man2html.c:190:1: warning[-Wunused-function]: ‘strduplicate’ defined but not used
# 190 | strduplicate(char *from)
# | ^~~~~~~~~~~~
# 188| */
# 189| static char *
# 190|-> strduplicate(char *from)
# 191| {
# 192| char *new = stralloc(strlen(from));
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/support/man2html.c:210:1: warning[-Wunused-function]: ‘strmaxcat’ defined but not used
# 210 | strmaxcat(char *to, char *from, int n)
# | ^~~~~~~~~
# 208|
# 209| static char *
# 210|-> strmaxcat(char *to, char *from, int n)
# 211| {
# 212| int to_len = strlen(to);
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/support/man2html.c:240:1: warning[-Wunused-function]: ‘escape_input’ defined but not used
# 240 | escape_input(char *str)
# | ^~~~~~~~~~~~
# 238| */
# 239| static char *
# 240|-> escape_input(char *str)
# 241| {
# 242| int i, j = 0;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:298:14: warning[-Wunused-variable]: ‘fname’ defined but not used
# 298 | static char *fname;
# | ^~~~~
# 296| #define INDEXFILE "/tmp/manindex.list"
# 297|
# 298|-> static char *fname;
# 299| static FILE *idxfile;
# 300|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:299:14: warning[-Wunused-variable]: ‘idxfile’ defined but not used
# 299 | static FILE *idxfile;
# | ^~~~~~~
# 297|
# 298| static char *fname;
# 299|-> static FILE *idxfile;
# 300|
# 301| static STRDEF *chardef, *strdef, *defdef;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:428:13: warning[-Wunused-variable]: ‘eqndelimopen’ defined but not used
# 428 | static char eqndelimopen = 0, eqndelimclose = 0;
# | ^~~~~~~~~~~~
# 426|
# 427|
# 428|-> static char eqndelimopen = 0, eqndelimclose = 0;
# 429| static char escapesym = '\\', nobreaksym = '\'', controlsym = '.', fieldsym = 0, padsym = 0;
# 430|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:428:31: warning[-Wunused-variable]: ‘eqndelimclose’ defined but not used
# 428 | static char eqndelimopen = 0, eqndelimclose = 0;
# | ^~~~~~~~~~~~~
# 426|
# 427|
# 428|-> static char eqndelimopen = 0, eqndelimclose = 0;
# 429| static char escapesym = '\\', nobreaksym = '\'', controlsym = '.', fieldsym = 0, padsym = 0;
# 430|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: In function ‘read_man_page’
bash-5.2.26-build/bash-5.2/support/man2html.c:508:17: warning[-Wunused-variable]: unused variable ‘i’
# 508 | int i;
# | ^
# 506| {
# 507| char *man_buf = NULL;
# 508|-> int i;
# 509| FILE *man_stream = NULL;
# 510| struct stat stbuf;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:937:12: warning[-Wunused-variable]: ‘asint’ defined but not used
# 937 | static int asint = 0;
# | ^~~~~
# 935| }
# 936|
# 937|-> static int asint = 0;
# 938| static int intresult = 0;
# 939|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:1439:17: warning[-Wunused-variable]: unused variable ‘t’
# 1439 | char *t, *h, *g;
# | ^
# 1437| scan_table(char *c)
# 1438| {
# 1439|-> char *t, *h, *g;
# 1440| int center = 0, expand = 0, box = 0, border = 0, linesize = 1;
# 1441| int i, j, maxcol = 0, finished = 0;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: In function ‘scan_table’
bash-5.2.26-build/bash-5.2/support/man2html.c:1444:44: warning[-Wunused-variable]: unused variable ‘ftable’
# 1444 | TABLEROW *layout = NULL, *currow, *ftable;
# | ^~~~~~
# 1442| int oldfont, oldsize, oldfillout;
# 1443| char itemsep = '\t';
# 1444|-> TABLEROW *layout = NULL, *currow, *ftable;
# 1445| TABLEITEM *curfield;
# 1446|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: In function ‘scan_expression’
bash-5.2.26-build/bash-5.2/support/man2html.c:1774:36: warning[-Wunused-variable]: unused variable ‘j’
# 1774 | int value = 0, value2, j = 0, sign = 1, opex = 0;
# | ^
# 1772| scan_expression(char *c, int *result)
# 1773| {
# 1774|-> int value = 0, value2, j = 0, sign = 1, opex = 0;
# 1775| char oper = 'c';
# 1776|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: In function ‘skip_till_newline’
bash-5.2.26-build/bash-5.2/support/man2html.c:2151:19: warning[-Wparentheses]: suggest parentheses around ‘&&’ within ‘||’
# 2151 | while (*c && *c != '\n' || lvl > 0) {
# | ~~~^~~~~~~~~~~~~
# 2149| int lvl = 0;
# 2150|
# 2151|-> while (*c && *c != '\n' || lvl > 0) {
# 2152| if (*c == '\\') {
# 2153| c++;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: In function ‘scan_request’
bash-5.2.26-build/bash-5.2/support/man2html.c:2243:41: warning[-Wunused-variable]: unused variable ‘oldcurpos’
# 2243 | int oldcurpos = curpos;
# | ^~~~~~~~~
# 2241| {
# 2242| STRDEF *de;
# 2243|-> int oldcurpos = curpos;
# 2244|
# 2245| c = c + j;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:2540:41: warning[-Wunused-variable]: unused variable ‘f’
# 2540 | FILE *f;
# | ^
# 2538| case V('s', 'o'):
# 2539| {
# 2540|-> FILE *f;
# 2541| struct stat stbuf;
# 2542| int l = 0;
Error: CPPCHECK_WARNING (CWE-786):
bash-5.2.26-build/bash-5.2/support/man2html.c:2699: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 2697| curpos++;
# 2698| }
# 2699|-> wordlist[i][-1] = ' ';
# 2700| out_html(change_to_font(font[i & 1]));
# 2701| scan_troff(wordlist[i], 1, NULL);
Error: CPPCHECK_WARNING (CWE-786):
bash-5.2.26-build/bash-5.2/support/man2html.c:2899: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 2897| char *t;
# 2898| for (i = 1; i < words; i++)
# 2899|-> wordlist[i][-1] = '\0';
# 2900| *sl = '\0';
# 2901| output_possible = 1;
Error: CPPCHECK_WARNING (CWE-786):
bash-5.2.26-build/bash-5.2/support/man2html.c:2938: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 2936| out_html(change_to_font('I'));
# 2937| if (words > 1)
# 2938|-> wordlist[1][-1] = '\0';
# 2939| c = lookup_abbrev(wordlist[0]);
# 2940| curpos += strlen(c);
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/support/man2html.c:3099: warning[uninitvar]: Uninitialized variable: list_options
# 3097| strlimitcpy(list_options, c, nl - c, MED_STR_MAX);
# 3098| }
# 3099|-> if (strstr(list_options, "-bullet")) { /* HTML Unnumbered List */
# 3100| dl_set[itemdepth] = BL_BULLET_LIST;
# 3101| out_html("<UL>\n");
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/support/man2html.c:3232: warning[uninitvar]: Uninitialized variable: bd_options
# 3230| mandoc_bd_options = 0; /* Remember options for
# 3231| * terminating Bl */
# 3232|-> if (strstr(bd_options, "-offset indent")) {
# 3233| mandoc_bd_options |= BD_INDENT;
# 3234| out_html("<BLOCKQUOTE>\n");
Error: CPPCHECK_WARNING (CWE-786):
bash-5.2.26-build/bash-5.2/support/man2html.c:3679: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 3677| *sl = '\0';
# 3678| for (i = 1; i < words; i++)
# 3679|-> wordlist[i][-1] = '\0';
# 3680| for (i = 0; i < words; i++) {
# 3681| char *h = NULL;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/support/man2html.c:3693:45: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3693 | for (i = 0; owndef->st[deflen + 2 + i] = owndef->st[i]; i++);
# | ^~~~~~
# 3691| wordlist[i] = NULL;
# 3692| deflen = strlen(owndef->st);
# 3693|-> for (i = 0; owndef->st[deflen + 2 + i] = owndef->st[i]; i++);
# 3694| oldargument = argument;
# 3695| argument = wordlist;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/support/man2html.c:3748:1: warning[-Wunused-function]: ‘flush’ defined but not used
# 3748 | flush(void)
# | ^~~~~
# 3746|
# 3747| static void
# 3748|-> flush(void)
# 3749| {
# 3750| }
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:3763:17: warning[-Wunused-variable]: unused variable ‘i’
# 3763 | int i;
# | ^
# 3761| char intbuff[NULL_TERMINATED(MED_STR_MAX)];
# 3762| int ibp = 0;
# 3763|-> int i;
# 3764| char *exbuffer;
# 3765| int exbuffpos, exbuffmax, exscaninbuff, exnewline_for_fun;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: In function ‘scan_troff’
bash-5.2.26-build/bash-5.2/support/man2html.c:3822:33: warning[-Wunused-variable]: unused variable ‘mx’
# 3822 | int mx;
# | ^~
# 3820| h--;
# 3821| } else {
# 3822|-> int mx;
# 3823|
# 3824| if (h[-1] == '\n' && still_dd && isalnum(*h)) {
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:3992:17: warning[-Wunused-variable]: unused variable ‘f’
# 3992 | FILE *f;
# | ^
# 3990| main(int argc, char **argv)
# 3991| {
# 3992|-> FILE *f;
# 3993| char *t;
# 3994| int l, i;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c:3994:17: warning[-Wunused-variable]: unused variable ‘l’
# 3994 | int l, i;
# | ^
# 3992| FILE *f;
# 3993| char *t;
# 3994|-> int l, i;
# 3995| char *buf;
# 3996| char *h, *fullname;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/support/man2html.c: scope_hint: In function ‘main’
bash-5.2.26-build/bash-5.2/support/man2html.c:3996:21: warning[-Wunused-variable]: unused variable ‘fullname’
# 3996 | char *h, *fullname;
# | ^~~~~~~~
# 3994| int l, i;
# 3995| char *buf;
# 3996|-> char *h, *fullname;
# 3997| STRDEF *stdf;
# 3998|
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/trap.c:443: error[legacyUninitvar]: Uninitialized variable: save_return_catch
# 441| if (return_catch_flag)
# 442| {
# 443|-> COPY_PROCENV (return_catch, save_return_catch);
# 444| function_code = setjmp_nosigs (return_catch);
# 445| }
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/trap.c: scope_hint: In function ‘restore_default_signal’
bash-5.2.26-build/bash-5.2/trap.c:918:15: warning[-Warray-bounds=]: array subscript 68 is above array bounds of ‘int[68]’
# 918 | if (sigmodes[sig] & SIG_HARD_IGNORE)
# | ~~~~~~~~^~~~~
bash-5.2.26-build/bash-5.2/trap.c:75:12: note: while referencing ‘sigmodes’
# 75 | static int sigmodes[BASH_NSIG];
# | ^~~~~~~~
# 916| /* A signal ignored on entry to the shell cannot be trapped or reset, but
# 917| no error is reported when attempting to do so. Thanks Posix.2. */
# 918|-> if (sigmodes[sig] & SIG_HARD_IGNORE)
# 919| return;
# 920|
Error: CPPCHECK_WARNING (CWE-457):
bash-5.2.26-build/bash-5.2/trap.c:1113: error[uninitvar]: Uninitialized variable: save_return_catch
# 1111| if (return_catch_flag)
# 1112| {
# 1113|-> COPY_PROCENV (return_catch, save_return_catch);
# 1114| function_code = setjmp_nosigs (return_catch);
# 1115| }
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/unwind_prot.c: scope_hint: In function ‘unwind_frame_discard_internal’
bash-5.2.26-build/bash-5.2/unwind_prot.c:272:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 272 | while (elt = unwind_protect_list)
# | ^~~
# 270|
# 271| found = 0;
# 272|-> while (elt = unwind_protect_list)
# 273| {
# 274| unwind_protect_list = unwind_protect_list->head.next;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/unwind_prot.c: scope_hint: In function ‘unwind_frame_run_internal’
bash-5.2.26-build/bash-5.2/unwind_prot.c:307:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 307 | while (elt = unwind_protect_list)
# | ^~~
# 305|
# 306| found = 0;
# 307|-> while (elt = unwind_protect_list)
# 308| {
# 309| unwind_protect_list = elt->head.next;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/variables.c:188:21: warning[-Wunused-variable]: ‘last_context_searched’ defined but not used
# 188 | static VAR_CONTEXT *last_context_searched;
# | ^~~~~~~~~~~~~~~~~~~~~
# 186|
# 187| static HASH_TABLE *last_table_searched; /* hash_lookup sets this */
# 188|-> static VAR_CONTEXT *last_context_searched;
# 189|
# 190| /* Some forward declarations. */
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘initialize_shell_variables’
bash-5.2.26-build/bash-5.2/variables.c:425:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 425 | if (temp_var = find_function (tname))
# | ^~~~~~~~
# 423| free (temp_string); /* parse_and_execute does this */
# 424|
# 425|-> if (temp_var = find_function (tname))
# 426| {
# 427| VSETATTR (temp_var, (att_exported|att_imported));
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c:432:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 432 | if (temp_var = bind_invalid_envvar (name, string, 0))
# | ^~~~~~~~
# 430| else
# 431| {
# 432|-> if (temp_var = bind_invalid_envvar (name, string, 0))
# 433| {
# 434| VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘set_machine_vars’
bash-5.2.26-build/bash-5.2/variables.c:723:14: warning[-Wunused-but-set-variable]: variable ‘temp_var’ set but not used
# 723 | SHELL_VAR *temp_var;
# | ^~~~~~~~
# 721| set_machine_vars ()
# 722| {
# 723|-> SHELL_VAR *temp_var;
# 724|
# 725| temp_var = set_if_not ("HOSTTYPE", HOSTTYPE);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘var_lookup’
bash-5.2.26-build/bash-5.2/variables.c:2012:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2012 | if (v = hash_lookup (name, vc->table))
# | ^
# 2010| v = (SHELL_VAR *)NULL;
# 2011| for (vc = vcontext; vc; vc = vc->down)
# 2012|-> if (v = hash_lookup (name, vc->table))
# 2013| break;
# 2014|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘nameref_transform_name’
bash-5.2.26-build/bash-5.2/variables.c:2322:9: warning[-Wunused-variable]: unused variable ‘newname’
# 2322 | char *newname;
# | ^~~~~~~
# 2320| {
# 2321| SHELL_VAR *v;
# 2322|-> char *newname;
# 2323|
# 2324| v = 0;
Error: COMPILER_WARNING (CWE-1164):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: At top level
bash-5.2.26-build/bash-5.2/variables.c:2554:1: warning[-Wunused-function]: ‘var_sametype’ defined but not used
# 2554 | var_sametype (v1, v2)
# | ^~~~~~~~~~~~
# 2552|
# 2553| static int
# 2554|-> var_sametype (v1, v2)
# 2555| SHELL_VAR *v1;
# 2556| SHELL_VAR *v2;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘delete_var’
bash-5.2.26-build/bash-5.2/variables.c:3958:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3958 | if (elt = hash_remove (name, v->table, 0))
# | ^~~
# 3956|
# 3957| for (elt = (BUCKET_CONTENTS *)NULL, v = vc; v; v = v->down)
# 3958|-> if (elt = hash_remove (name, v->table, 0))
# 3959| break;
# 3960|
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘makunbound’
bash-5.2.26-build/bash-5.2/variables.c:3987:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3987 | if (elt = hash_remove (name, v->table, 0))
# | ^~~
# 3985|
# 3986| for (elt = (BUCKET_CONTENTS *)NULL, v = vc; v; v = v->down)
# 3987|-> if (elt = hash_remove (name, v->table, 0))
# 3988| break;
# 3989|
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘push_posix_temp_var’
bash-5.2.26-build/bash-5.2/variables.c:4556:15: warning[-Wunused-but-set-variable]: variable ‘binding_table’ set but not used
# 4556 | HASH_TABLE *binding_table;
# | ^~~~~~~~~~~~~
# 4554| {
# 4555| SHELL_VAR *var, *v;
# 4556|-> HASH_TABLE *binding_table;
# 4557|
# 4558| var = (SHELL_VAR *)data;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘mk_env_string’
bash-5.2.26-build/bash-5.2/variables.c:4760:15: warning[-Wunused-variable]: unused variable ‘isarray’
# 4760 | int isfunc, isarray;
# | ^~~~~~~
# 4758| size_t name_len, value_len;
# 4759| char *p, *q, *t;
# 4760|-> int isfunc, isarray;
# 4761|
# 4762| name_len = strlen (name);
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘make_env_array_from_var_list’
bash-5.2.26-build/bash-5.2/variables.c:4896:31: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4896 | for (i = 0, list_index = 0; var = vars[i]; i++)
# | ^~~
# 4894| list = strvec_create ((1 + strvec_len ((char **)vars)));
# 4895|
# 4896|-> for (i = 0, list_index = 0; var = vars[i]; i++)
# 4897| {
# 4898| #if defined (__CYGWIN__)
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘pop_var_context’
bash-5.2.26-build/bash-5.2/variables.c:5420:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5420 | if (ret = vcxt->down)
# | ^~~
# 5418| }
# 5419|
# 5420|-> if (ret = vcxt->down)
# 5421| {
# 5422| ret->up = (VAR_CONTEXT *)NULL;
Error: COMPILER_WARNING (CWE-563):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘pop_scope’
bash-5.2.26-build/bash-5.2/variables.c:5520:7: warning[-Wunused-but-set-variable]: variable ‘is_bltinenv’ set but not used
# 5520 | int is_bltinenv;
# | ^~~~~~~~~~~
# 5518| {
# 5519| VAR_CONTEXT *vcxt, *ret;
# 5520|-> int is_bltinenv;
# 5521|
# 5522| vcxt = shell_variables;
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘sv_history_control’
bash-5.2.26-build/bash-5.2/variables.c:6179:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6179 | while (val = extract_colon_unit (temp, &tptr))
# | ^~~
# 6177|
# 6178| tptr = 0;
# 6179|-> while (val = extract_colon_unit (temp, &tptr))
# 6180| {
# 6181| if (STREQ (val, "ignorespace"))
Error: COMPILER_WARNING (CWE-569):
bash-5.2.26-build/bash-5.2/variables.c: scope_hint: In function ‘sv_histtimefmt’
bash-5.2.26-build/bash-5.2/variables.c:6228:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6228 | if (v = find_variable (name))
# | ^
# 6226| SHELL_VAR *v;
# 6227|
# 6228|-> if (v = find_variable (name))
# 6229| {
# 6230| if (history_comment_char == 0)
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.2.26-build/bash-5.2/shell.h:31: included_from: Included from here.
bash-5.2.26-build/bash-5.2/arrayfunc.c:32: included_from: Included from here.
bash-5.2.26-build/bash-5.2/arrayfunc.c: scope_hint: In function ‘assign_compound_array_list’
bash-5.2.26-build/bash-5.2/variables.h:144:41: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘var’
bash-5.2.26-build/bash-5.2/arrayfunc.c:731:7: note: in expansion of macro ‘assoc_p’
bash-5.2.26-build/bash-5.2/arrayfunc.c:731:7: note: in expansion of macro ‘assoc_p’
bash-5.2.26-build/bash-5.2/arrayfunc.c:731:7: note: in expansion of macro ‘assoc_p’
# 142| #define integer_p(var) ((((var)->attributes) & (att_integer)))
# 143| #define local_p(var) ((((var)->attributes) & (att_local)))
# 144|-> #define assoc_p(var) ((((var)->attributes) & (att_assoc)))
# 145| #define trace_p(var) ((((var)->attributes) & (att_trace)))
# 146| #define uppercase_p(var) ((((var)->attributes) & (att_uppercase)))
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/xmalloc.c:135:20: warning[-Walloc-size-larger-than=]: argument 2 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
# 135 | temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# | ^
/usr/include/stdlib.h: scope_hint: In function ‘shell_getc’
/usr/include/stdlib.h:683:14: note: in a call to allocation function ‘realloc’ declared here
# 683 | extern void *realloc (void *__ptr, size_t __size)
# | ^
# 133|
# 134| FINDBRK();
# 135|-> temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# 136|
# 137| if (temp == 0)
Error: COMPILER_WARNING:
bash-5.2.26-build/bash-5.2/xmalloc.c:135:47: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
# 135 | temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# | ^
/usr/include/stdlib.h: scope_hint: In function ‘shell_getc’
/usr/include/stdlib.h:672:14: note: in a call to allocation function ‘malloc’ declared here
# 672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
# | ^
# 133|
# 134| FINDBRK();
# 135|-> temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# 136|
# 137| if (temp == 0)