Task #130643 - bash-5.3.15-2.fc45/scan-results.err
back to task #130643download
Error: SHELLCHECK_WARNING (CWE-480):
/usr/bin/bashbug-64:57:9: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 55| VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
# 56|
# 57|-> do_help= do_version=
# 58|
# 59| while [ $# -gt 0 ]; do
Error: SHELLCHECK_WARNING (CWE-480):
/usr/bin/bashbug-64:99:6: warning[SC1007]: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
# 97| case "$N" in
# 98| *c) n=-n c= ;;
# 99|-> *) n= c='\c' ;;
# 100| esac
# 101|
Error: SHELLCHECK_WARNING (CWE-456):
/usr/bin/bashbug-64:146:3: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string).
# 144| DEFEDITOR=jove
# 145| elif [ -x /usr/bin/vi ]; then
# 146|-> DEFEDITOR=vi
# 147| else
# 148| echo "$0: No default editor found: attempting to use vi" >&2
Error: SHELLCHECK_WARNING (CWE-456):
/usr/bin/bashbug-64:149:3: warning[SC2209]: Use var=$(command) to assign output (or quote to assign string).
# 147| else
# 148| echo "$0: No default editor found: attempting to use vi" >&2
# 149|-> DEFEDITOR=vi
# 150| fi
# 151| fi
Error: SHELLCHECK_WARNING (CWE-398):
/usr/bin/bashbug-64:158:40: warning[SC2172]: Trapping signals by number is not well defined. Prefer signal names.
# 156| : ${USER=${LOGNAME-`whoami`}}
# 157|
# 158|-> trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
# 159| trap 'rm -rf "$TEMPDIR"' 0
# 160|
Error: SHELLCHECK_WARNING (CWE-252):
/usr/bin/cd:2:1: warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
# 1| #!/usr/bin/sh
# 2|-> builtin cd "$@"
Error: COMPILER_WARNING (CWE-563):
bash-5.3/array.c:66:14: warning[-Wunused-variable]: ‘spacesep’ defined but not used
# 66 | static char *spacesep = " ";
# | ^~~~~~~~
# 64| static char *array_to_string_internal (ARRAY_ELEMENT *, ARRAY_ELEMENT *, char *, int);
# 65|
# 66|-> static char *spacesep = " ";
# 67|
# 68| #define IS_LASTREF(a) (a->lastref)
Error: COMPILER_WARNING (CWE-563):
bash-5.3/arrayfunc.c: scope_hint: In function ‘assign_array_element_internal’
bash-5.3/arrayfunc.c:388:9: warning[-Wunused-variable]: unused variable ‘newval’
# 388 | char *newval;
# | ^~~~~~
# 386| char *akey, *nkey;
# 387| arrayind_t ind;
# 388|-> char *newval;
# 389|
# 390| /* rely on the caller to initialize estatep */
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.3/arrayfunc.c:652:41: warning[-Wanalyzer-null-argument]: use of NULL ‘v’ where non-null expected
bash-5.3/arrayfunc.c:636:24: branch_true: following ‘true’ branch (when ‘list’ is non-NULL)...
bash-5.3/arrayfunc.c:638:11: branch_true: ...to here
bash-5.3/arrayfunc.c:652:14: branch_true: following ‘true’ branch...
bash-5.3/arrayfunc.c:652:41: branch_true: ...to here
bash-5.3/arrayfunc.c:652:41: danger: argument 1 (‘v’) NULL where non-null expected
# 650| }
# 651|
# 652|-> aval = split_kvpair_assignments ? savestring (v) : expand_assignment_string_to_string (v, 0);
# 653| if (aval == 0)
# 654| {
Error: COMPILER_WARNING:
bash-5.3/arrayfunc.c: scope_hint: In function ‘array_value_internal’
bash-5.3/arrayfunc.c:1485:21: warning[-Wunused-but-set-variable=]: variable ‘subtype’ set but not used
# 1485 | int len, isassoc, subtype;
# | ^~~~~~~
# 1483| array_value_internal (const char *s, int quoted, int flags, array_eltstate_t *estatep)
# 1484| {
# 1485|-> int len, isassoc, subtype;
# 1486| arrayind_t ind;
# 1487| char *akey;
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/arrayfunc.c:1623:18: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ind’
bash-5.3/arrayfunc.c:1483:1: enter_function: entry to ‘array_value_internal’
bash-5.3/arrayfunc.c:1492:9: call_function: calling ‘array_variable_part’ from ‘array_value_internal’
bash-5.3/arrayfunc.c:1492:9: return_function: returning to ‘array_value_internal’ from ‘array_variable_part’
bash-5.3/arrayfunc.c:1501:6: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1504:13: branch_false: ...to here
bash-5.3/arrayfunc.c:1570:10: branch_false: following ‘false’ branch (when ‘estatep’ is NULL)...
bash-5.3/arrayfunc.c:1572:10: branch_false: ...to here
bash-5.3/arrayfunc.c:1572:10: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1605:14: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1612:10: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1617:15: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1622:11: branch_false: ...to here
bash-5.3/arrayfunc.c:1622:10: branch_true: following ‘true’ branch...
bash-5.3/arrayfunc.c:1623:18: danger: use of uninitialized value ‘ind’ here
# 1621| }
# 1622| if (array_p (var) == 0 && assoc_p (var) == 0)
# 1623|-> retval = (ind == 0) ? value_cell (var) : (char *)NULL;
# 1624| else if (assoc_p (var))
# 1625| {
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/arrayfunc.c:1635:18: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ind’
bash-5.3/arrayfunc.c:1483:1: enter_function: entry to ‘array_value_internal’
bash-5.3/arrayfunc.c:1492:9: call_function: calling ‘array_variable_part’ from ‘array_value_internal’
bash-5.3/arrayfunc.c:1492:9: return_function: returning to ‘array_value_internal’ from ‘array_variable_part’
bash-5.3/arrayfunc.c:1501:6: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1504:13: branch_false: ...to here
bash-5.3/arrayfunc.c:1570:10: branch_false: following ‘false’ branch (when ‘estatep’ is NULL)...
bash-5.3/arrayfunc.c:1572:10: branch_false: ...to here
bash-5.3/arrayfunc.c:1572:10: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1605:14: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1612:10: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1617:15: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1622:11: branch_false: ...to here
bash-5.3/arrayfunc.c:1622:10: branch_true: following ‘true’ branch...
bash-5.3/arrayfunc.c:1622:33: branch_true: ...to here
bash-5.3/arrayfunc.c:1622:11: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1624:16: branch_false: ...to here
bash-5.3/arrayfunc.c:1624:15: branch_false: following ‘false’ branch...
bash-5.3/arrayfunc.c:1635:18: branch_false: ...to here
bash-5.3/arrayfunc.c:1635:18: danger: use of uninitialized value ‘ind’ here
# 1633| }
# 1634| else
# 1635|-> retval = array_reference (array_cell (var), ind);
# 1636|
# 1637| if (estatep)
Error: COMPILER_WARNING (CWE-457):
bash-5.3/arrayfunc.c: scope_hint: In function ‘array_value_internal’
bash-5.3/arrayfunc.c:1635:18: warning[-Wmaybe-uninitialized]: ‘ind’ may be used uninitialized
# 1635 | retval = array_reference (array_cell (var), ind);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.3/arrayfunc.c:1486:14: note: ‘ind’ was declared here
# 1486 | arrayind_t ind;
# | ^~~
# 1633| }
# 1634| else
# 1635|-> retval = array_reference (array_cell (var), ind);
# 1636|
# 1637| if (estatep)
Error: COMPILER_WARNING (CWE-563):
bash-5.3/arrayfunc.c: scope_hint: In function ‘array_keys’
bash-5.3/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.3/assoc.h:31:37: warning[-Wmaybe-uninitialized]: ‘h’ may be used uninitialized
# 31 | #define assoc_num_elements(h) ((h)->nentries)
# | ~~~~^~~~~~~~~~~
bash-5.3/subst.c: scope_hint: In function ‘parameter_brace_substring’
bash-5.3/subst.c:8403:14: note: ‘h’ was declared here
# 8403 | 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.3/bashhist.c: scope_hint: In function ‘hc_erasedups’
bash-5.3/bashhist.c:732:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 732 | while (temp = previous_history ())
# | ^~~~
# 730|
# 731| using_history ();
# 732|-> while (temp = previous_history ())
# 733| {
# 734| if (STREQ (temp->line, line))
Error: COMPILER_WARNING (CWE-704):
bash-5.3/bashhist.c: scope_hint: In function ‘bash_syslog_history’
bash-5.3/bashhist.c:848:16: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 848 | for (msg = line, i = 0; i < chunks; i++)
# | ^
# 846| {
# 847| chunks = ((msglen + hdrlen) / SYSLOG_MAXLEN) + 1;
# 848|-> for (msg = line, i = 0; i < chunks; i++)
# 849| {
# 850| seqnum = inttostr (i + 1, seqbuf, sizeof (seqbuf));
Error: COMPILER_WARNING (CWE-704):
bash-5.3/bashhist.c:848:16: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 846| {
# 847| chunks = ((msglen + hdrlen) / SYSLOG_MAXLEN) + 1;
# 848|-> for (msg = line, i = 0; i < chunks; i++)
# 849| {
# 850| seqnum = inttostr (i + 1, seqbuf, sizeof (seqbuf));
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/bashline.c: scope_hint: At top level
bash-5.3/bashline.c:215:12: warning[-Wunused-function]: ‘set_saved_history’ declared ‘static’ but never defined
# 215 | static int set_saved_history (void);
# | ^~~~~~~~~~~~~~~~~
# 213| static int isolate_sequence (char *, int, int, int *);
# 214|
# 215|-> static int set_saved_history (void);
# 216|
# 217| #if defined (ALIAS)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘snarf_hosts_from_file’
bash-5.3/bashline.c:809:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 809 | while (temp = fgets (buffer, 255, file))
# | ^~~~
# 807| return;
# 808|
# 809|-> while (temp = fgets (buffer, 255, file))
# 810| {
# 811| /* Skip to first character. */
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.3/bashline.c:1238:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/bashline.c:1233:1: enter_function: entry to ‘bash_kill_shellword’
bash-5.3/bashline.c:1238:12: call_function: calling ‘bash_backward_kill_shellword’ from ‘bash_kill_shellword’
# 1236|
# 1237| if (count < 0)
# 1238|-> return (bash_backward_kill_shellword (-count, key));
# 1239|
# 1240| p = rl_point;
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.3/bashline.c:1259:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/bashline.c:1254:1: enter_function: entry to ‘bash_backward_kill_shellword’
bash-5.3/bashline.c:1259:12: call_function: calling ‘bash_kill_shellword’ from ‘bash_backward_kill_shellword’
# 1257|
# 1258| if (count < 0)
# 1259|-> return (bash_kill_shellword (-count, key));
# 1260|
# 1261| p = rl_point;
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/bashline.c:1705: error[uninitvar]: Uninitialized variable: e1
# 1703| if (s > rl_end)
# 1704| {
# 1705|-> s1 = s = e1;
# 1706| break;
# 1707| }
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/bashline.c:1705:20: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘e1’
bash-5.3/bashline.c:1683:6: branch_true: following ‘true’ branch (when ‘matches’ is NULL)...
bash-5.3/bashline.c:1683:7: branch_true: ...to here
bash-5.3/bashline.c:1683:7: branch_true: following ‘true’ branch...
bash-5.3/bashline.c:1691:11: branch_true: ...to here
bash-5.3/bashline.c:1703:14: branch_true: following ‘true’ branch...
bash-5.3/bashline.c:1705:20: branch_true: ...to here
bash-5.3/bashline.c:1705:20: danger: use of uninitialized value ‘e1’ here
# 1703| if (s > rl_end)
# 1704| {
# 1705|-> s1 = s = e1;
# 1706| break;
# 1707| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘attempt_shell_completion’
bash-5.3/bashline.c:1726:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1726 | while (was_assignment = assignment (n, 0));
# | ^~~~~~~~~~~~~~
# 1724| s = e1 + 1;
# 1725| }
# 1726|-> while (was_assignment = assignment (n, 0));
# 1727| s = s1; /* reset to index where name begins */
# 1728|
Error: COMPILER_WARNING (CWE-457):
bash-5.3/bashline.c: scope_hint: In function ‘attempt_shell_completion’
bash-5.3/bashline.c:1743:28: warning[-Wmaybe-uninitialized]: ‘e1’ may be used uninitialized
# 1743 | else if (e == 0 && e == s && text[0] == '\0' && have_progcomps) /* beginning of empty line */
# | ~~^~~~
bash-5.3/bashline.c:1687:21: note: ‘e1’ was declared here
# 1687 | int s, e, s1, e1, os, foundcs;
# | ^~
# 1741| else if (start == 0 && start == end && start < s1 && e != 0 && e1 > end && text[0] == '\0' && have_progcomps) /* no command name, leading whitespace only */
# 1742| prog_complete_matches = programmable_completions (EMPTYCMD, text, s, e, &foundcs);
# 1743|-> else if (e == 0 && e == s && text[0] == '\0' && have_progcomps) /* beginning of empty line */
# 1744| prog_complete_matches = programmable_completions (EMPTYCMD, text, s, e, &foundcs);
# 1745| else if (start == end && text[0] == '\0' && s1 > start && whitespace (rl_line_buffer[start]))
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘command_word_completion_function’
bash-5.3/bashline.c:2262:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2262 | while (val = glob_matches[local_index++])
# | ^~~
# 2260| }
# 2261|
# 2262|-> while (val = glob_matches[local_index++])
# 2263| {
# 2264| if (executable_or_directory (val))
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘bash_servicename_completion_function’
bash-5.3/bashline.c:2688:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2688 | while (srvent = getservent ())
# | ^~~~~~
# 2686| }
# 2687|
# 2688|-> while (srvent = getservent ())
# 2689| {
# 2690| afound = 0;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘bash_groupname_completion_function’
bash-5.3/bashline.c:2742:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2742 | while (grent = getgrent ())
# | ^~~~~
# 2740| }
# 2741|
# 2742|-> while (grent = getgrent ())
# 2743| {
# 2744| if (gnamelen == 0 || (STREQN (gname, grent->gr_name, gnamelen)))
Error: COMPILER_WARNING (CWE-563):
bash-5.3/bashline.c:2830:9: warning[-Wunused-variable]: unused variable ‘s’
# 2830 | char *s, *t;
# | ^
# 2828|
# 2829| int old_point, old_end, dist, nb;
# 2830|-> char *s, *t;
# 2831|
# 2832| /* If we didn't expand anything, don't change anything. */
Error: COMPILER_WARNING (CWE-563):
bash-5.3/bashline.c: scope_hint: In function ‘set_up_new_line’
bash-5.3/bashline.c:2830:13: warning[-Wunused-variable]: unused variable ‘t’
# 2830 | char *s, *t;
# | ^
# 2828|
# 2829| int old_point, old_end, dist, nb;
# 2830|-> char *s, *t;
# 2831|
# 2832| /* If we didn't expand anything, don't change anything. */
Error: COMPILER_WARNING (CWE-457):
bash-5.3/bashline.c: scope_hint: In function ‘_ignore_completion_names’
bash-5.3/bashline.c:3127:17: warning[-Wmaybe-uninitialized]: ‘oldnames’ may be used uninitialized
# 3127 | oldnames[oidx++] = names[idx];
# | ^
bash-5.3/bashline.c:3087:10: note: ‘oldnames’ was declared here
# 3087 | char **oldnames;
# | ^~~~~~~~
# 3125| newnames[nidx++] = names[idx];
# 3126| else if (allow_empty == 0)
# 3127|-> oldnames[oidx++] = names[idx];
# 3128| else
# 3129| free (names[idx]);
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/bashline.c:3143:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oldnames’
bash-5.3/bashline.c:3198:1: enter_function: entry to ‘filename_completion_ignore’
bash-5.3/bashline.c:3207:6: branch_false: following ‘false’ branch...
bash-5.3/bashline.c:3210:3: branch_false: ...to here
bash-5.3/bashline.c:3210:3: call_function: calling ‘_ignore_completion_names’ from ‘filename_completion_ignore’
# 3141| }
# 3142| else
# 3143|-> free (oldnames);
# 3144|
# 3145| free (newnames);
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.3/bashline.c:3364:7: warning[-Wanalyzer-null-argument]: use of NULL ‘dh2’ where non-null expected
bash-5.3/bashline.c:3288:1: enter_function: entry to ‘restore_tilde’
bash-5.3/bashline.c:3297:9: branch_false: following ‘false’ branch (when ‘directory_part’ is NULL)...
bash-5.3/bashline.c:3297:3: branch_false: ...to here
bash-5.3/bashline.c:3298:3: call_function: calling ‘bash_directory_expansion’ from ‘restore_tilde’
# 3362| char *d, *nd;
# 3363|
# 3364|-> d = savestring (*dirname);
# 3365|
# 3366| if ((rl_directory_rewrite_hook) && (*rl_directory_rewrite_hook) (&d))
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘bash_filename_stat_hook’
bash-5.3/bashline.c:3525:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3525 | if (t = mbschr (local_dirname, '$'))
# | ^
# 3523| local_dirname = *dirname;
# 3524| should_expand_dirname = return_value = 0;
# 3525|-> if (t = mbschr (local_dirname, '$'))
# 3526| should_expand_dirname = '$';
# 3527| else if (t = mbschr (local_dirname, '`')) /* XXX */
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c:3527:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3527 | else if (t = mbschr (local_dirname, '`')) /* XXX */
# | ^
# 3525| if (t = mbschr (local_dirname, '$'))
# 3526| should_expand_dirname = '$';
# 3527|-> else if (t = mbschr (local_dirname, '`')) /* XXX */
# 3528| should_expand_dirname = '`';
# 3529|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/bashline.c: scope_hint: In function ‘bash_directory_completion_hook’
bash-5.3/bashline.c:3679:18: warning[-Wunused-variable]: unused variable ‘l1’
# 3679 | size_t l1, l2;
# | ^~
# 3677| if (temp2 == 0 && dircomplete_spelling && dircomplete_expand)
# 3678| {
# 3679|-> size_t l1, l2;
# 3680|
# 3681| temp2 = dirspell (temp1);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘bash_check_expchar’
bash-5.3/bashline.c:4303:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4303 | if (t = mbschr (dirname, '$'))
# | ^
# 4301|
# 4302| ret = n = c = 0;
# 4303|-> if (t = mbschr (dirname, '$'))
# 4304| {
# 4305| ret = '$';
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘set_filename_quote_chars’
bash-5.3/bashline.c:4362:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4362 | for (i = j = 0; c = default_filename_quote_characters[i]; i++)
# | ^
# 4360| i = strlen (default_filename_quote_characters);
# 4361| custom_filename_quote_characters = xrealloc (custom_filename_quote_characters, i+1);
# 4362|-> for (i = j = 0; c = default_filename_quote_characters[i]; i++)
# 4363| {
# 4364| if (c == expchar || c == nextch || c == closer)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/bashline.c:4532:1: warning[-Wunused-function]: ‘putx’ defined but not used
# 4532 | putx(int c)
# | ^~~~
# 4530| static int
# 4531| #endif
# 4532|-> putx(int c)
# 4533| {
# 4534| int x;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/bashline.c:4762:1: warning[-Wunused-function]: ‘get_cmd_xmap_from_edit_mode’ defined but not used
# 4762 | get_cmd_xmap_from_edit_mode (void)
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 4760|
# 4761| static Keymap
# 4762|-> get_cmd_xmap_from_edit_mode (void)
# 4763| {
# 4764| if (emacs_std_cmd_xmap == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/bashline.c: scope_hint: In function ‘isolate_sequence’
bash-5.3/bashline.c:4824:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4824 | for (passc = 0; c = string[i]; i++)
# | ^
# 4822| *startp = delim ? ++i : i;
# 4823|
# 4824|-> for (passc = 0; c = string[i]; i++)
# 4825| {
# 4826| if (passc)
Error: COMPILER_WARNING (CWE-457):
bash-5.3/braces.c:388:6: warning[-Wmaybe-uninitialized]: ‘tr’ may be used uninitialized
# 388 | if ((start < end) == (incr < 0) && ckd_sub (&incr, 0, incr))
# | ^
bash-5.3/braces.c: scope_hint: In function ‘brace_expand’
bash-5.3/braces.c:523:16: note: ‘tr’ was declared here
# 523 | intmax_t tl, tr;
# | ^~
# 386|
# 387| /* Make sure incr agrees with start and end */
# 388|-> if ((start < end) == (incr < 0) && ckd_sub (&incr, 0, incr))
# 389| return ((char **)NULL);
# 390|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/braces.c: scope_hint: In function ‘mkseq’
bash-5.3/braces.c:445:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 445 | if (t = (char *)malloc (2))
# | ^
# 443| else
# 444| {
# 445|-> if (t = (char *)malloc (2))
# 446| {
# 447| t[0] = n;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/braces.c:452:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘result’
bash-5.3/braces.c:392:6: branch_false: following ‘false’ branch...
bash-5.3/braces.c:397:7: branch_false: ...to here
bash-5.3/braces.c:397:6: branch_false: following ‘false’ branch...
bash-5.3/braces.c:400:12: branch_false: ...to here
bash-5.3/braces.c:401:6: branch_false: following ‘false’ branch...
bash-5.3/braces.c:401:6: branch_false: ...to here
bash-5.3/braces.c:413:10: branch_true: following ‘true’ branch...
bash-5.3/braces.c:415:17: branch_true: ...to here
bash-5.3/braces.c:421:10: branch_true: following ‘true’ branch (when ‘type == 1’)...
bash-5.3/braces.c:422:13: branch_true: ...to here
bash-5.3/braces.c:452:7: danger: dereference of NULL ‘result + i * 8’
# 450| }
# 451|
# 452|-> result[i++] = t;
# 453|
# 454| /* We failed to allocate memory for this number, so we bail. */
Error: COMPILER_WARNING:
bash-5.3/braces.c:643:9: warning[-Wunused-but-set-variable=]: variable ‘t’ set but not used
# 643 | char *t;
# | ^
# 641| #if defined (SHELL)
# 642| size_t si;
# 643|-> char *t;
# 644| #endif
# 645| DECLARE_MBSTATE;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/braces.c: scope_hint: In function ‘brace_gobbler’
bash-5.3/braces.c:656:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 656 | while (c = text[i])
# | ^
# 654|
# 655| i = *indx;
# 656|-> while (c = text[i])
# 657| {
# 658| if (pass_next)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/braces.c:687:1: warning[-Wunused-label]: label ‘funsub’ defined but not used
# 687 | funsub:
# | ^~~~~~
# 685| {
# 686| int o, f;
# 687|-> funsub:
# 688| o = no_longjmp_on_fatal_error;
# 689| no_longjmp_on_fatal_error = 1;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/braces.c:862:11: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘result’
bash-5.3/braces.c:841:6: branch_false: following ‘false’ branch (when ‘result’ is non-NULL)...
bash-5.3/braces.c:841:6: branch_false: ...to here
bash-5.3/braces.c:845:15: branch_true: following ‘true’ branch...
bash-5.3/braces.c:847:34: branch_true: ...to here
bash-5.3/braces.c:849:19: branch_true: following ‘true’ branch...
bash-5.3/braces.c:852:15: branch_true: ...to here
bash-5.3/braces.c:852:14: branch_true: following ‘true’ branch...
bash-5.3/braces.c:854:21: branch_true: ...to here
bash-5.3/braces.c:862:11: danger: dereference of NULL ‘result + (long unsigned int)len * 8’
# 860| #endif
# 861|
# 862|-> result[len] = (char *)xmalloc (1 + strlen_1 + strlen (arr2[j]));
# 863| strcpy (result[len], arr1[i]);
# 864| strcpy (result[len] + strlen_1, arr2[j]);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/alias.def: scope_hint: In function ‘alias_builtin’
bash-5.3/builtins/alias.def:108:13: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 108 | if (any_failed = print_alias (alias_list[offset], dflags) != EXECUTION_SUCCESS)
# | ^~~~~~~~~~
# 106| any_failed = EXECUTION_SUCCESS;
# 107| for (offset = 0; alias_list[offset]; offset++)
# 108|-> if (any_failed = print_alias (alias_list[offset], dflags) != EXECUTION_SUCCESS)
# 109| break;
# 110|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/alias.def: scope_hint: In function ‘unalias_builtin’
bash-5.3/builtins/alias.def:175:12: warning[-Wunused-variable]: unused variable ‘alias’
# 175 | alias_t *alias;
# | ^~~~~
# 173| unalias_builtin (WORD_LIST *list)
# 174| {
# 175|-> alias_t *alias;
# 176| int opt, aflag;
# 177|
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/builtins/break.def:80:18: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘list’
bash-5.3/builtins/break.def:69:6: branch_false: following ‘false’ branch...
bash-5.3/builtins/break.def:73:50: branch_false: ...to here
bash-5.3/builtins/break.def:75:6: branch_true: following ‘true’ branch...
bash-5.3/builtins/break.def:78:10: branch_true: ...to here
bash-5.3/builtins/break.def:78:10: branch_false: following ‘false’ branch (when ‘list’ is NULL)...
bash-5.3/builtins/break.def:80:36: branch_false: ...to here
bash-5.3/builtins/break.def:80:18: danger: dereference of NULL ‘list’
# 78| if (list && list->word && ISOPTION (list->word->word, '-'))
# 79| list = list->next;
# 80|-> sh_erange (list->word->word, _("loop count"));
# 81| breaking = loop_level;
# 82| return (EXECUTION_FAILURE);
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/builtins/break.def:125:18: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘list’
bash-5.3/builtins/break.def:114:6: branch_false: following ‘false’ branch...
bash-5.3/builtins/break.def:118:50: branch_false: ...to here
bash-5.3/builtins/break.def:120:6: branch_true: following ‘true’ branch...
bash-5.3/builtins/break.def:123:10: branch_true: ...to here
bash-5.3/builtins/break.def:123:10: branch_false: following ‘false’ branch (when ‘list’ is NULL)...
bash-5.3/builtins/break.def:125:36: branch_false: ...to here
bash-5.3/builtins/break.def:125:18: danger: dereference of NULL ‘list’
# 123| if (list && list->word && ISOPTION (list->word->word, '-'))
# 124| list = list->next;
# 125|-> sh_erange (list->word->word, _("loop count"));
# 126| breaking = loop_level;
# 127| return (EXECUTION_FAILURE);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/builtins/cd.def: scope_hint: At top level
bash-5.3/builtins/cd.def:195:1: warning[-Wunused-function]: ‘cdxattr’ defined but not used
# 195 | cdxattr (char *dir, char **ndirp)
# | ^~~~~~~
# 193| /* return new constructed directory name in *NDIRP */
# 194| static int
# 195|-> cdxattr (char *dir, char **ndirp)
# 196| {
# 197| #if defined (O_XATTR)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/cd.def: scope_hint: In function ‘cd_builtin’
bash-5.3/builtins/cd.def:357:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 357 | while (path = extract_colon_unit (cdpath, &path_index))
# | ^~~~
# 355| /* Find directory in $CDPATH, POSIX cd step 5. */
# 356| path_index = 0;
# 357|-> while (path = extract_colon_unit (cdpath, &path_index))
# 358| {
# 359| /* OPT is 1 if the path element is non-empty */
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/cd.def: scope_hint: In function ‘change_to_directory’
bash-5.3/builtins/cd.def:524:20: warning[-Wunused-variable]: unused variable ‘ndir’
# 524 | char *t, *tdir, *ndir;
# | ^~~~
# 522| change_to_directory (char *newdir, int nolinks, int xattr)
# 523| {
# 524|-> char *t, *tdir, *ndir;
# 525| int err, canon_failed, r, ndlen;
# 526|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/declare.def: scope_hint: In function ‘declare_find_variable’
bash-5.3/builtins/declare.def:153:14: warning[-Wunused-variable]: unused variable ‘var’
# 153 | SHELL_VAR *var;
# | ^~~
# 151| declare_find_variable (const char *name, int mkglobal, int chklocal)
# 152| {
# 153|-> SHELL_VAR *var;
# 154|
# 155| if (mkglobal == 0)
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/builtins/declare.def:237:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘optchar’
bash-5.3/builtins/declare.def:224:6: branch_true: following ‘true’ branch...
bash-5.3/builtins/declare.def:228:10: branch_false: following ‘false’ branch...
bash-5.3/builtins/declare.def:230:16: branch_false: ...to here
bash-5.3/builtins/declare.def:230:15: branch_false: following ‘false’ branch...
bash-5.3/builtins/declare.def:232:16: branch_false: ...to here
bash-5.3/builtins/declare.def:232:15: branch_false: following ‘false’ branch...
bash-5.3/builtins/declare.def:234:16: branch_false: ...to here
bash-5.3/builtins/declare.def:234:15: branch_false: following ‘false’ branch...
bash-5.3/builtins/declare.def:237:7: branch_false: ...to here
bash-5.3/builtins/declare.def:237:7: danger: use of uninitialized value ‘optchar’ here
# 235| optchar = "-a";
# 236|
# 237|-> sh_invalidopt (optchar);
# 238| return (EXECUTION_FAILURE);
# 239| }
Error: COMPILER_WARNING (CWE-457):
bash-5.3/builtins/declare.def:237:7: warning[-Wmaybe-uninitialized]: ‘optchar’ may be used uninitialized
# 237 | sh_invalidopt (optchar);
# | ^~~~~~~~~~~~~~~~~~~~~~~
bash-5.3/builtins/declare.def: scope_hint: In function ‘declare_internal’
bash-5.3/builtins/declare.def:226:13: note: ‘optchar’ was declared here
# 226 | char *optchar;
# | ^~~~~~~
# 235| optchar = "-a";
# 236|
# 237|-> sh_invalidopt (optchar);
# 238| return (EXECUTION_FAILURE);
# 239| }
Error: COMPILER_WARNING:
bash-5.3/builtins/declare.def:423:11: warning[-Wunused-but-set-variable=]: variable ‘var_exists’ set but not used
# 423 | int var_exists, array_exists, creating_array, array_subscript_assignment;
# | ^~~~~~~~~~
# 421| #if defined (ARRAY_VARS)
# 422| int making_array_special, compound_array_assign, simple_array_assign;
# 423|-> int var_exists, array_exists, creating_array, array_subscript_assignment;
# 424| #endif
# 425|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/declare.def: scope_hint: In function ‘declare_internal’
bash-5.3/builtins/declare.def:467:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 467 | if (var = find_function (name))
# | ^~~
# 465| if (offset && (flags_on & att_function)) /* declare -f [-rix] foo=bar */
# 466| {
# 467|-> if (var = find_function (name))
# 468| offset = 0;
# 469| else
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/declare.def:593:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 593 | if (t = strchr (name, '[')) /* ] */
# | ^
# 591| compound_array_assign = simple_array_assign = 0;
# 592| array_subscript_assignment = 0;
# 593|-> if (t = strchr (name, '[')) /* ] */
# 594| {
# 595| /* If offset != 0 we have already validated any array reference
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/echo.def: scope_hint: In function ‘echo_builtin’
bash-5.3/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.3/builtins/enable.def: scope_hint: In function ‘enable_builtin’
bash-5.3/builtins/enable.def:120:9: warning[-Wmaybe-uninitialized]: ‘filename’ may be used uninitialized
# 120 | char *filename;
# | ^~~~~~~~
# 118| WORD_LIST *next;
# 119| #if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
# 120|-> char *filename;
# 121| #endif
# 122|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/enable.def: scope_hint: In function ‘dyn_load_builtin’
bash-5.3/builtins/enable.def:363:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 363 | else if (loadables_path = path_value ("BASH_LOADABLES_PATH", 1))
# | ^~~~~~~~~~~~~~
# 361| if (absolute_program (filename))
# 362| handle = dlopen (filename, DLFLAGS);
# 363|-> else if (loadables_path = path_value ("BASH_LOADABLES_PATH", 1))
# 364| {
# 365| /* If we have a loadables path, don't fall back to the current directory. */
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/evalstring.c: scope_hint: In function ‘parse_and_execute’
bash-5.3/builtins/evalstring.c:461:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 461 | else if (command = global_command)
# | ^~~~~~~
# 459| global_command = (COMMAND *)NULL;
# 460| }
# 461|-> else if (command = global_command)
# 462| {
# 463| struct fd_bitmap *bitmap;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/builtins/evalstring.c: scope_hint: At top level
bash-5.3/builtins/evalstring.c:802:1: warning[-Wunused-function]: ‘cat_file’ defined but not used
# 802 | cat_file (REDIRECT *r)
# | ^~~~~~~~
# 800| output. */
# 801| static int
# 802|-> cat_file (REDIRECT *r)
# 803| {
# 804| char *fn;
Error: COMPILER_WARNING (CWE-704):
bash-5.3/builtins/getopt.c: scope_hint: In function ‘sh_getopt’
bash-5.3/builtins/getopt.c:168:8: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 168 | temp = strchr (optstring, c);
# | ^
# 166|
# 167| c = *nextchar++; sh_charindex++;
# 168|-> temp = strchr (optstring, c);
# 169|
# 170| sh_optopt = c;
Error: COMPILER_WARNING (CWE-704):
bash-5.3/builtins/getopt.c:168:8: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 166|
# 167| c = *nextchar++; sh_charindex++;
# 168|-> temp = strchr (optstring, c);
# 169|
# 170| sh_optopt = c;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/getopt.c:179:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 179 | if (sh_badopt = (temp == NULL || c == ':'))
# | ^~~~~~~~~
# 177| }
# 178|
# 179|-> if (sh_badopt = (temp == NULL || c == ':'))
# 180| {
# 181| if (sh_opterr)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/help.def: scope_hint: In function ‘help_builtin’
bash-5.3/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.3/builtins/help.def:235:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’
bash-5.3/builtins/help.def:224:1: enter_function: entry to ‘show_longdoc’
bash-5.3/builtins/help.def:232:6: branch_true: following ‘true’ branch...
bash-5.3/builtins/help.def:234:12: call_function: calling ‘open_helpfile’ from ‘show_longdoc’
bash-5.3/builtins/help.def:234:12: return_function: returning to ‘show_longdoc’ from ‘open_helpfile’
bash-5.3/builtins/help.def:235:10: danger: ‘open_helpfile(*doc)’ leaks here; was opened at [(6)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/5)
# 233| {
# 234| fd = open_helpfile (doc[0]);
# 235|-> if (fd < 0)
# 236| return;
# 237| zcatfd (fd, 1, doc[0]);
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.3/builtins/help.def:259:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’
bash-5.3/builtins/help.def:246:1: enter_function: entry to ‘show_desc’
bash-5.3/builtins/help.def:255:13: branch_true: following ‘true’ branch...
bash-5.3/builtins/help.def:258:12: call_function: calling ‘open_helpfile’ from ‘show_desc’
bash-5.3/builtins/help.def:258:12: return_function: returning to ‘show_desc’ from ‘open_helpfile’
bash-5.3/builtins/help.def:259:10: danger: ‘open_helpfile(*doc)’ leaks here; was opened at [(6)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/5)
# 257| {
# 258| fd = open_helpfile (doc[0]);
# 259|-> if (fd < 0)
# 260| return;
# 261| r = zmapfd (fd, &line, doc[0]);
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.3/builtins/help.def:301:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open_helpfile(*doc)’
bash-5.3/builtins/help.def:287:1: enter_function: entry to ‘show_manpage’
bash-5.3/builtins/help.def:297:13: branch_true: following ‘true’ branch...
bash-5.3/builtins/help.def:300:12: call_function: calling ‘open_helpfile’ from ‘show_manpage’
bash-5.3/builtins/help.def:300:12: return_function: returning to ‘show_manpage’ from ‘open_helpfile’
bash-5.3/builtins/help.def:301:10: danger: ‘open_helpfile(*doc)’ leaks here; was opened at [(6)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/5)
# 299| {
# 300| fd = open_helpfile (doc[0]);
# 301|-> if (fd < 0)
# 302| return;
# 303| r = zmapfd (fd, &line, doc[0]);
Error: CPPCHECK_WARNING (CWE-476):
bash-5.3/builtins/help.def:326: warning[nullPointer]: Possible null pointer dereference: line
# 324| /* If the line doesn't end with a newline, e.g., if it's a loadable builtin,
# 325| add one. */
# 326|-> if (line[j] != '\n')
# 327| putchar ('\n');
# 328| printf ("\n");
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/builtins/help.def:326:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
bash-5.3/builtins/help.def:313:12: branch_false: following ‘false’ branch (when ‘doc’ is NULL)...
bash-5.3/builtins/help.def:313:5: branch_false: ...to here
bash-5.3/builtins/help.def:318:15: release_memory: ‘line’ is NULL
bash-5.3/builtins/help.def:318:15: branch_false: following ‘false’ branch...
bash-5.3/builtins/help.def:326:11: branch_false: ...to here
bash-5.3/builtins/help.def:326:11: release_memory: ‘line’ is NULL
bash-5.3/builtins/help.def:326:7: danger: dereference of NULL ‘line + (sizetype)j’
# 324| /* If the line doesn't end with a newline, e.g., if it's a loadable builtin,
# 325| add one. */
# 326|-> if (line[j] != '\n')
# 327| putchar ('\n');
# 328| printf ("\n");
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/help.def: scope_hint: In function ‘show_builtin_command_help’
bash-5.3/builtins/help.def:514:9: warning[-Wunused-variable]: unused variable ‘t’
# 514 | char *t, blurb[128];
# | ^
# 512| int i;
# 513| int height, width;
# 514|-> char *t, blurb[128];
# 515|
# 516| printf (
Error: COMPILER_WARNING (CWE-457):
/usr/include/features.h:540: included_from: Included from here.
/usr/include/bits/libc-header-start.h:33: included_from: Included from here.
/usr/include/wchar.h:27: included_from: Included from here.
bash-5.3/config-bot.h:137: included_from: Included from here.
bash-5.3/config.h:1384: included_from: Included from here.
bash-5.3/builtins/history.def:65: included_from: Included from here.
bash-5.3/builtins/history.def:190:59: warning[-Wmaybe-uninitialized]: ‘delete_arg’ may be used uninitialized
# 190 | else if ((flags & DFLAG) && (range = strchr ((delete_arg[0] == '-') ? delete_arg + 1 : delete_arg, '-')))
# | ~~~~~~~~~~^~~
bash-5.3/builtins/history.def:117:20: note: ‘delete_arg’ was declared here
# 117 | char *filename, *delete_arg, *range;
# | ^~~~~~~~~~
# 188| }
# 189| #endif
# 190|-> else if ((flags & DFLAG) && (range = strchr ((delete_arg[0] == '-') ? delete_arg + 1 : delete_arg, '-')))
# 191| {
# 192| intmax_t delete_start, delete_end;
Error: COMPILER_WARNING (CWE-691):
bash-5.3/builtins/history.def: scope_hint: In function ‘history_builtin’
bash-5.3/builtins/history.def:278:10: warning[-Wdangling-else]: suggest explicit braces to avoid ambiguous ‘else’
# 278 | if (interactive_shell == 0 || interactive)
# | ^
# 276| if (filename == 0 || *filename == 0)
# 277| {
# 278|-> if (interactive_shell == 0 || interactive)
# 279| if (list && filename == list->word->word)
# 280| builtin_error (_("empty filename"));
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/builtins/let.def:107: warning[uninitvar]: Uninitialized variable: ret
# 105| }
# 106|
# 107|-> return ((ret == 0) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
# 108| }
# 109|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/mkbuiltins.c: scope_hint: In function ‘extract_info’
bash-5.3/builtins/mkbuiltins.c:588:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 588 | for (i = 0; line = defs->lines->array[i]; i++)
# | ^~~~
# 586|
# 587| /* Process each line in the array. */
# 588|-> for (i = 0; line = defs->lines->array[i]; i++)
# 589| {
# 590| defs->line_number = i;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/mkbuiltins.c: scope_hint: In function ‘free_defs’
bash-5.3/builtins/mkbuiltins.c:702:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 702 | for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++)
# | ^~~~~~~
# 700| if (defs->builtins)
# 701| {
# 702|-> for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++)
# 703| {
# 704| free_builtin (builtin);
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.3/builtins/mkbuiltins.c:1389:3: warning[-Wanalyzer-null-argument]: use of NULL ‘stream’ where non-null expected
bash-5.3/builtins/mkbuiltins.c:1292:1: enter_function: entry to ‘write_longdocs’
bash-5.3/builtins/mkbuiltins.c:1299:15: branch_true: following ‘true’ branch...
bash-5.3/builtins/mkbuiltins.c:1301:33: branch_true: ...to here
bash-5.3/builtins/mkbuiltins.c:1303:10: branch_true: following ‘true’ branch...
bash-5.3/builtins/mkbuiltins.c:1304:9: branch_true: ...to here
bash-5.3/builtins/mkbuiltins.c:1304:9: call_function: inlined call to ‘write_ifdefs’ from ‘write_longdocs’
bash-5.3/builtins/mkbuiltins.c:1307:15: branch_true: ...to here
bash-5.3/builtins/mkbuiltins.c:1307:15: branch_true: following ‘true’ branch...
bash-5.3/builtins/mkbuiltins.c:1308:7: branch_true: ...to here
bash-5.3/builtins/mkbuiltins.c:1310:10: branch_true: following ‘true’ branch...
bash-5.3/builtins/mkbuiltins.c:1312:19: branch_true: ...to here
bash-5.3/builtins/mkbuiltins.c:1313:31: call_function: calling ‘xmalloc’ from ‘write_longdocs’
bash-5.3/builtins/mkbuiltins.c:1313:31: return_function: returning to ‘write_longdocs’ from ‘xmalloc’
bash-5.3/builtins/mkbuiltins.c:1315:11: release_memory: ‘stream’ is NULL
bash-5.3/builtins/mkbuiltins.c:1316:11: call_function: calling ‘write_documentation’ from ‘write_longdocs’
bash-5.3/builtins/mkbuiltins.c:1316:11: return_function: returning to ‘write_longdocs’ from ‘write_documentation’
bash-5.3/builtins/mkbuiltins.c:1322:10: branch_true: following ‘true’ branch...
bash-5.3/builtins/mkbuiltins.c:1323:9: branch_true: ...to here
bash-5.3/builtins/mkbuiltins.c:1323:9: call_function: inlined call to ‘write_endifs’ from ‘write_longdocs’
#argument 4 of ‘__builtin_fwrite’ must be non-null
# 1387| return;
# 1388|
# 1389|-> fprintf (stream, "#endif /* ");
# 1390|
# 1391| for (i = 0; defines[i]; i++)
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def:246:15: warning[-Wunused-variable]: ‘narg_argv’ defined but not used
# 246 | static char **narg_argv;
# | ^~~~~~~~~
# 244|
# 245| /* printf format numbered argument support */
# 246|-> static char **narg_argv;
# 247| static int narg_argc;
# 248| static int narg_maxind;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def:247:12: warning[-Wunused-variable]: ‘narg_argc’ defined but not used
# 247 | static int narg_argc;
# | ^~~~~~~~~
# 245| /* printf format numbered argument support */
# 246| static char **narg_argv;
# 247|-> static int narg_argc;
# 248| static int narg_maxind;
# 249| static int narg_curind;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def:248:12: warning[-Wunused-variable]: ‘narg_maxind’ defined but not used
# 248 | static int narg_maxind;
# | ^~~~~~~~~~~
# 246| static char **narg_argv;
# 247| static int narg_argc;
# 248|-> static int narg_maxind;
# 249| static int narg_curind;
# 250|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def:249:12: warning[-Wunused-variable]: ‘narg_curind’ defined but not used
# 249 | static int narg_curind;
# | ^~~~~~~~~~~
# 247| static int narg_argc;
# 248| static int narg_maxind;
# 249|-> static int narg_curind;
# 250|
# 251| static intmax_t tw;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def: scope_hint: In function ‘printwidestr’
bash-5.3/builtins/printf.def:962:9: warning[-Wunused-variable]: unused variable ‘s’
# 962 | char *s;
# | ^
# 960| printwidestr (char *fmt, wchar_t *wstring, size_t len, int fieldwidth, int precision)
# 961| {
# 962|-> char *s;
# 963| char *string;
# 964| int padlen, nc, ljust, i;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def: scope_hint: In function ‘bexpand’
bash-5.3/builtins/printf.def:1178:13: warning[-Wunused-variable]: unused variable ‘c’
# 1178 | int temp, c;
# | ^
# 1176| bexpand (char *string, size_t len, int *sawc, size_t *lenp)
# 1177| {
# 1178|-> int temp, c;
# 1179| char *ret, *r, *s, *send;
# 1180| #if defined (HANDLE_MULTIBYTE)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/printf.def: scope_hint: In function ‘getint’
bash-5.3/builtins/printf.def:1417:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1417 | if (overflow = (errno == ERANGE) || (ret < INT_MIN || ret > INT_MAX))
# | ^~~~~~~~
# 1415| errno = 0;
# 1416| ret = strtoimax (arg, &ep, 0);
# 1417|-> if (overflow = (errno == ERANGE) || (ret < INT_MIN || ret > INT_MAX))
# 1418| errno = ERANGE; /* force errno */
# 1419|
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/builtins/printf.def:1539:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.3/builtins/printf.def:1520:1: enter_function: entry to ‘asciicode’
bash-5.3/builtins/printf.def:1530:9: call_function: inlined call to ‘getarg’ from ‘asciicode’
bash-5.3/builtins/printf.def:1532:18: branch_false: ...to here
bash-5.3/builtins/printf.def:1535:6: branch_false: following ‘false’ branch (when ‘mblength > 18446744073709551613’)...
bash-5.3/builtins/printf.def:1539:25: branch_false: ...to here
bash-5.3/builtins/printf.def:1539:25: danger: dereference of NULL ‘<unknown>’
# 1537| else
# 1538| #endif
# 1539|-> ch = (unsigned char)arg[1];
# 1540|
# 1541| advancearg ();
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def: scope_hint: In function ‘getwidechar’
bash-5.3/builtins/printf.def:1588:10: warning[-Wunused-variable]: unused variable ‘slen’
# 1588 | size_t slen, mblength;
# | ^~~~
# 1586| {
# 1587| wchar_t wc;
# 1588|-> size_t slen, mblength;
# 1589| char *arg;
# 1590| DECLARE_MBSTATE;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/builtins/printf.def: scope_hint: In function ‘convwidestr’
bash-5.3/builtins/printf.def:1613:11: warning[-Wunused-variable]: unused variable ‘wc’
# 1613 | wchar_t wc;
# | ^~
# 1611| {
# 1612| const wchar_t *ts;
# 1613|-> wchar_t wc;
# 1614| char *ret;
# 1615| size_t rlen, rsize;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/builtins/printf.def: scope_hint: At top level
bash-5.3/builtins/printf.def:1653:1: warning[-Wunused-function]: ‘convwidechar’ defined but not used
# 1653 | convwidechar (wint_t wi, int prec)
# | ^~~~~~~~~~~~
# 1651|
# 1652| static char *
# 1653|-> convwidechar (wint_t wi, int prec)
# 1654| {
# 1655| wchar_t wc;
Error: GCC_ANALYZER_WARNING (CWE-479):
bash-5.3/builtins/psize.c:53:3: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘fprintf’ from within signal handler
bash-5.3/builtins/psize.c:58:1: enter_function: entry to ‘main’
bash-5.3/builtins/psize.c:63:15: branch_true: following ‘true’ branch (when ‘i != 128’)...
bash-5.3/builtins/psize.c:64:5: branch_true: ...to here
bash-5.3/builtins/psize.c:51:1: enter_function: entry to ‘sigpipe’
bash-5.3/builtins/psize.c:53:3: danger: call to ‘fprintf’ from within signal handler
# 51| sigpipe (int sig)
# 52| {
# 53|-> fprintf (stderr, "%d\n", nw);
# 54| exit (0);
# 55| }
Error: GCC_ANALYZER_WARNING (CWE-479):
bash-5.3/builtins/psize.c:54:3: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler
bash-5.3/builtins/psize.c:58:1: enter_function: entry to ‘main’
bash-5.3/builtins/psize.c:63:15: branch_true: following ‘true’ branch (when ‘i != 128’)...
bash-5.3/builtins/psize.c:64:5: branch_true: ...to here
bash-5.3/builtins/psize.c:51:1: enter_function: entry to ‘sigpipe’
bash-5.3/builtins/psize.c:54:3: danger: call to ‘exit’ from within signal handler
# 52| {
# 53| fprintf (stderr, "%d\n", nw);
# 54|-> exit (0);
# 55| }
# 56|
Error: CPPCHECK_WARNING (CWE-476):
bash-5.3/builtins/read.def:860: error[nullPointer]: Null pointer dereference
# 858| {
# 859| size_t clen;
# 860|-> clen = mbrlen (rlbuf + rlind - 1, mb_cur_max, (mbstate_t *)NULL);
# 861| /* We only deal with valid multibyte sequences longer than one
# 862| byte. If we get anything else, we leave the one character
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/builtins/set.def:562: warning[uninitvar]: Uninitialized variable: tflag
# 560| for (i = vptr = 0; o_options[i].name; i++)
# 561| {
# 562|-> if (tflag[i])
# 563| {
# 564| strcpy (value + vptr, o_options[i].name);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/set.def: scope_hint: In function ‘parse_shellopts’
bash-5.3/builtins/set.def:600:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 600 | while (vname = extract_colon_unit (value, &vptr))
# | ^~~~~
# 598|
# 599| vptr = 0;
# 600|-> while (vname = extract_colon_unit (value, &vptr))
# 601| {
# 602| set_minus_o_option (FLAG_ON, vname);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/set.def: scope_hint: In function ‘set_builtin’
bash-5.3/builtins/set.def:725:18: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 725 | while (flag_name = *++arg)
# | ^~~~~~~~~
# 723| if ((on_or_off = *arg) && (on_or_off == '-' || on_or_off == '+'))
# 724| {
# 725|-> while (flag_name = *++arg)
# 726| {
# 727| if (flag_name == '?')
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/set.def: scope_hint: In function ‘unset_builtin’
bash-5.3/builtins/set.def:957:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 957 | if (var = find_function (name))
# | ^~~
# 955| }
# 956| #endif
# 957|-> if (var = find_function (name))
# 958| unset_function = 1;
# 959| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/set.def:1003:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1003 | if (var = array_variable_part (tname, 0, &t, &len))
# | ^~~
# 1001| tname = savestring (nameref_cell (var));
# 1002| tem = 0;
# 1003|-> if (var = array_variable_part (tname, 0, &t, &len))
# 1004| {
# 1005| /* change to what unbind_array_element now expects */
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/setattr.def: scope_hint: In function ‘set_or_show_attributes’
bash-5.3/builtins/setattr.def:323:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 323 | for (i = 0; var = variable_list[i]; i++)
# | ^~~
# 321| if (variable_list)
# 322| {
# 323|-> for (i = 0; var = variable_list[i]; i++)
# 324| {
# 325| #if defined (ARRAY_VARS)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/setattr.def:340:23: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 340 | if (any_failed = sh_chkwrite (any_failed))
# | ^~~~~~~~~~
# 338| {
# 339| show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
# 340|-> if (any_failed = sh_chkwrite (any_failed))
# 341| break;
# 342| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/setattr.def: scope_hint: In function ‘show_all_var_attributes’
bash-5.3/builtins/setattr.def:372:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 372 | for (i = any_failed = 0; var = variable_list[i]; i++)
# | ^~~
# 370| return (EXECUTION_SUCCESS);
# 371|
# 372|-> for (i = any_failed = 0; var = variable_list[i]; i++)
# 373| {
# 374| /* There is no equivalent `declare -'. */
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/setattr.def:379:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 379 | if (any_failed = sh_chkwrite (any_failed))
# | ^~~~~~~~~~
# 377| else
# 378| show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
# 379|-> if (any_failed = sh_chkwrite (any_failed))
# 380| break;
# 381| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/setattr.def: scope_hint: In function ‘show_local_var_attributes’
bash-5.3/builtins/setattr.def:399:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 399 | for (i = any_failed = 0; var = variable_list[i]; i++)
# | ^~~
# 397| return (EXECUTION_SUCCESS);
# 398|
# 399|-> for (i = any_failed = 0; var = variable_list[i]; i++)
# 400| {
# 401| /* There is no equivalent `declare -'. */
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/setattr.def:406:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 406 | if (any_failed = sh_chkwrite (any_failed))
# | ^~~~~~~~~~
# 404| else
# 405| show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
# 406|-> if (any_failed = sh_chkwrite (any_failed))
# 407| break;
# 408| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/shopt.def: scope_hint: In function ‘toggle_shopts’
bash-5.3/builtins/shopt.def:484:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 484 | if (v = find_variable ("BASHOPTS"))
# | ^
# 482|
# 483| /* Don't set $BASHOPTS here if it hasn't already been initialized */
# 484|-> if (v = find_variable ("BASHOPTS"))
# 485| set_bashopts ();
# 486| return (rval);
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/builtins/shopt.def:844: warning[uninitvar]: Uninitialized variable: tflag
# 842| for (i = vptr = 0; shopt_vars[i].name; i++)
# 843| {
# 844|-> if (tflag[i])
# 845| {
# 846| strcpy (value + vptr, shopt_vars[i].name);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/shopt.def: scope_hint: In function ‘parse_bashopts’
bash-5.3/builtins/shopt.def:882:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 882 | while (vname = extract_colon_unit (value, &vptr))
# | ^~~~~
# 880|
# 881| vptr = 0;
# 882|-> while (vname = extract_colon_unit (value, &vptr))
# 883| {
# 884| ind = find_shopt (vname);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/builtins/type.def: scope_hint: In function ‘describe_command’
bash-5.3/builtins/type.def:353:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 353 | if (full_path = phash_search (command))
# | ^~~~~~~~~
# 351| if (all == 0 || (dflags & CDESC_FORCE_PATH))
# 352| {
# 353|-> if (full_path = phash_search (command))
# 354| {
# 355| if (dflags & CDESC_TYPE)
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.3/builtins/type.def:427:9: warning[-Wanalyzer-null-argument]: use of NULL ‘full_path’ where non-null expected
bash-5.3/builtins/type.def:383:10: branch_false: following ‘false’ branch (when ‘full_path’ is non-NULL)...
bash-5.3/builtins/type.def:391:11: branch_false: ...to here
bash-5.3/builtins/type.def:398:18: branch_false: following ‘false’ branch (when ‘all != 0’)...
bash-5.3/builtins/type.def:419:7: branch_false: ...to here
bash-5.3/builtins/type.def:427:9: danger: argument 1 (‘full_path’) NULL where non-null expected
#argument 1 of ‘__builtin_puts’ must be non-null
# 425| printf (_("%s is %s\n"), command, full_path);
# 426| else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY))
# 427|-> printf ("%s\n", full_path);
# 428|
# 429| free (full_path);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/builtins/ulimit.def:224:12: warning[-Wunused-function]: ‘set_all_limits’ declared ‘static’ but never defined
# 224 | static int set_all_limits (int, RLIMTYPE);
# | ^~~~~~~~~~~~~~
# 222| static void print_all_limits (int);
# 223|
# 224|-> static int set_all_limits (int, RLIMTYPE);
# 225|
# 226| static int filesize (RLIMTYPE *);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/builtins/umask.def: scope_hint: In function ‘parse_symbolic_mode’
bash-5.3/builtins/umask.def:344:1: warning[-Wunused-label]: label ‘spec_error’ defined but not used
# 344 | spec_error:
# | ^~~~~~~~~~
# 342| else
# 343| {
# 344|-> spec_error:
# 345| builtin_error (_("`%c': invalid symbolic mode character"), *s);
# 346| return (-1);
Error: COMPILER_WARNING:
bash-5.3/builtins/wait.def: scope_hint: In function ‘wait_builtin’
bash-5.3/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-569):
bash-5.3/eval.c: scope_hint: In function ‘reader_loop’
bash-5.3/eval.c:156:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 156 | else if (current_command = global_command)
# | ^~~~~~~~~~~~~~~
# 154| global_command = (COMMAND *)NULL;
# 155| }
# 156|-> else if (current_command = global_command)
# 157| {
# 158| global_command = (COMMAND *)NULL;
Error: COMPILER_WARNING (CWE-252):
bash-5.3/eval.c: scope_hint: In function ‘alrm_catcher’
bash-5.3/eval.c:262:3: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 262 | write (1, msg, strlen (msg));
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 260|
# 261| msg = _("\007timed out waiting for input: auto-logout\n");
# 262|-> write (1, msg, strlen (msg));
# 263|
# 264| bash_logout (); /* run ~/.bash_logout if this is a login shell */
Error: COMPILER_WARNING (CWE-563):
bash-5.3/execute_cmd.c:291:12: warning[-Wunused-variable]: ‘connection_count’ defined but not used
# 291 | static int connection_count;
# | ^~~~~~~~~~~~~~~~
# 289| static int showing_function_line;
# 290|
# 291|-> static int connection_count;
# 292|
# 293| /* $LINENO ($BASH_LINENO) for use by an ERR trap. Global so parse_and_execute
Error: COMPILER_WARNING (CWE-457):
bash-5.3/execute_cmd.c: scope_hint: In function ‘execute_command_internal’
bash-5.3/execute_cmd.c:1209:9: warning[-Wmaybe-uninitialized]: ‘ofifo_list’ may be used uninitialized
# 1209 | close_new_fifos (ofifo_list, osize);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.3/execute_cmd.c:638:9: note: ‘ofifo_list’ was declared here
# 638 | void *ofifo_list; /* void * volatile ofifo_list; */
# | ^~~~~~~~~~
# 1207| nfifo = num_fifos ();
# 1208| if (nfifo > ofifo)
# 1209|-> close_new_fifos (ofifo_list, osize);
# 1210| free (ofifo_list);
# 1211| discard_unwind_frame ("internal_fifos");
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/execute_cmd.c:1498: error[uninitvar]: Uninitialized variable: save_top_level
# 1496| rv = EXECUTION_SUCCESS; /* suppress uninitialized use warnings */
# 1497| old_flags = command->flags;
# 1498|-> COPY_PROCENV (top_level, save_top_level);
# 1499| command->flags &= ~(CMD_TIME_PIPELINE|CMD_TIME_POSIX);
# 1500| code = setjmp_nosigs (top_level);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/execute_cmd.c: scope_hint: At top level
bash-5.3/execute_cmd.c:1894:13: warning[-Wunused-function]: ‘cpl_prune’ declared ‘static’ but never defined
# 1894 | static void cpl_prune (void);
# | ^~~~~~~~~
# 1892| static struct cpelement *cpl_search (pid_t);
# 1893| static struct cpelement *cpl_searchbyname (const char *);
# 1894|-> static void cpl_prune (void);
# 1895|
# 1896| static void coproc_free (struct coproc *);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/execute_cmd.c:1945:1: warning[-Wunused-function]: ‘cpl_delete’ defined but not used
# 1945 | cpl_delete (pid_t pid)
# | ^~~~~~~~~~
# 1943|
# 1944| static struct cpelement *
# 1945|-> cpl_delete (pid_t pid)
# 1946| {
# 1947| struct cpelement *prev, *p;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/execute_cmd.c:3316:12: warning[-Wunused-variable]: ‘LINES’ defined but not used
# 3316 | static int LINES, COLS, tabsize;
# | ^~~~~
# 3314|
# 3315| #if defined (SELECT_COMMAND)
# 3316|-> static int LINES, COLS, tabsize;
# 3317|
# 3318| #define RP_SPACE ") "
Error: COMPILER_WARNING (CWE-563):
bash-5.3/execute_cmd.c: scope_hint: In function ‘select_query’
bash-5.3/execute_cmd.c:3443:23: warning[-Wunused-variable]: unused variable ‘t’
# 3443 | char *repl_string, *t;
# | ^
# 3441| intmax_t reply;
# 3442| WORD_LIST *l;
# 3443|-> char *repl_string, *t;
# 3444|
# 3445| COLS = default_columns ();
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/expr.c:1134:1: warning[-Wunused-function]: ‘alloc_lvalue’ defined but not used
# 1134 | alloc_lvalue (void)
# | ^~~~~~~~~~~~
# 1132|
# 1133| static struct lvalue *
# 1134|-> alloc_lvalue (void)
# 1135| {
# 1136| struct lvalue *lv;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/expr.c: scope_hint: At top level
bash-5.3/expr.c:1144:1: warning[-Wunused-function]: ‘free_lvalue’ defined but not used
# 1144 | free_lvalue (struct lvalue *lv)
# | ^~~~~~~~~~~
# 1142|
# 1143| static void
# 1144|-> free_lvalue (struct lvalue *lv)
# 1145| {
# 1146| free (lv); /* should be inlined */
Error: COMPILER_WARNING (CWE-563):
bash-5.3/expr.c: scope_hint: In function ‘strlong’
bash-5.3/expr.c:1557:17: warning[-Wunused-variable]: unused variable ‘pval’
# 1557 | intmax_t val, pval;
# | ^~~~
# 1555| register unsigned char c;
# 1556| int base, foundbase;
# 1557|-> intmax_t val, pval;
# 1558|
# 1559| s = num;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/findcmd.c: scope_hint: In function ‘_find_user_command_internal’
bash-5.3/findcmd.c:284:14: warning[-Wunused-variable]: unused variable ‘var’
# 284 | SHELL_VAR *var;
# | ^~~
# 282| {
# 283| char *path_list, *cmd;
# 284|-> SHELL_VAR *var;
# 285|
# 286| /* Search for the value of PATH in both the temporary environments and
Error: CPPCHECK_WARNING (CWE-476):
bash-5.3/findcmd.c:510: warning[nullPointer]: Possible null pointer dereference: match_list
# 508| }
# 509|
# 510|-> match = match_list[match_index];
# 511|
# 512| if (match)
Error: COMPILER_WARNING (CWE-665):
bash-5.3/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.3/general.c: scope_hint: In function ‘assignment’
bash-5.3/general.c:504:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 504 | while (c = string[indx])
# | ^
# 502| return (0);
# 503|
# 504|-> while (c = string[indx])
# 505| {
# 506| /* The following is safe. Note that '=' at the start of a word
Error: COMPILER_WARNING (CWE-457):
bash-5.3/shell.h:29: included_from: Included from here.
bash-5.3/subst.c:50: included_from: Included from here.
bash-5.3/subst.c: scope_hint: In function ‘parameter_brace_expand_length’
bash-5.3/general.h:169:78: warning[-Wmaybe-uninitialized]: ‘t’ may be used uninitialized
# 169 | #define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
bash-5.3/subst.c:8260:9: note: ‘t’ was declared here
# 8260 | char *t, *newname;
# | ^
# 167|
# 168| /* More convenience definitions that possibly save system or libc calls. */
# 169|-> #define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
# 170| #define FREE(s) do { if (s) free (s); } while (0)
# 171| #define MEMBER(c, s) (((c) && c == (s)[0] && !(s)[1]) || (member(c, s)))
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/hashlib.c:164:1: warning[-Wunused-function]: ‘hash_shrink’ defined but not used
# 164 | hash_shrink (HASH_TABLE *table)
# | ^~~~~~~~~~~
# 162|
# 163| static void
# 164|-> hash_shrink (HASH_TABLE *table)
# 165| {
# 166| int nsize;
Error: COMPILER_WARNING:
bash-5.3/jobs.c: scope_hint: In function ‘procsub_waitall’
bash-5.3/jobs.c:1149:7: warning[-Wunused-but-set-variable=]: variable ‘r’ set but not used
# 1149 | int r;
# | ^
# 1147| {
# 1148| PROCESS *p;
# 1149|-> int r;
# 1150|
# 1151| for (p = procsubs.head; p; p = p->next)
Error: COMPILER_WARNING:
bash-5.3/jobs.c:1183:20: warning[-Wunused-but-set-variable=]: variable ‘oend’ set but not used
# 1183 | PROCESS *ohead, *oend, *ps, *p;
# | ^~~~
# 1181| procsub_prune (void)
# 1182| {
# 1183|-> PROCESS *ohead, *oend, *ps, *p;
# 1184| int onproc;
# 1185|
Error: COMPILER_WARNING:
bash-5.3/jobs.c: scope_hint: In function ‘procsub_prune’
bash-5.3/jobs.c:1184:7: warning[-Wunused-but-set-variable=]: variable ‘onproc’ set but not used
# 1184 | int onproc;
# | ^~~~~~
# 1182| {
# 1183| PROCESS *ohead, *oend, *ps, *p;
# 1184|-> int onproc;
# 1185|
# 1186| if (procsubs.nproc == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/jobs.c: scope_hint: In function ‘nohup_job’
bash-5.3/jobs.c:1555:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1555 | if (temp = jobs[job_index])
# | ^~~~
# 1553| return;
# 1554|
# 1555|-> if (temp = jobs[job_index])
# 1556| temp->flags |= J_NOHUP;
# 1557| }
Error: COMPILER_WARNING (CWE-457):
bash-5.3/jobs.c: scope_hint: In function ‘make_child’
bash-5.3/jobs.c:2327:7: warning[-Wmaybe-uninitialized]: ‘oterm’ may be used uninitialized
# 2327 | set_signal_handler (SIGTERM, oterm);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.3/jobs.c:2272:15: note: ‘oterm’ was declared here
# 2272 | SigHandler *oterm;
# | ^~~~~
# 2325| if (pid != 0)
# 2326| if (interactive_shell)
# 2327|-> set_signal_handler (SIGTERM, oterm);
# 2328|
# 2329| if (pid < 0)
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/jobs.c:2718:10: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.3/jobs.c:3642:1: enter_function: entry to ‘notify_and_cleanup’
bash-5.3/jobs.c:3647:3: call_function: calling ‘maybe_print_job_notifications’ from ‘notify_and_cleanup’
# 2716| p = find_last_proc (job, block);
# 2717| /* Possible race condition here. */
# 2718|-> return p->pid;
# 2719| }
# 2720|
Error: COMPILER_WARNING:
bash-5.3/jobs.c: scope_hint: In function ‘wait_for_background_pids’
bash-5.3/jobs.c:2799:20: warning[-Wunused-but-set-variable=]: variable ‘check_async’ set but not used
# 2799 | int any_stopped, check_async, njobs;
# | ^~~~~~~~~~~
# 2797| {
# 2798| register int i, r;
# 2799|-> int any_stopped, check_async, njobs;
# 2800| sigset_t set, oset;
# 2801| pid_t pid;
Error: COMPILER_WARNING:
bash-5.3/jobs.c: scope_hint: In function ‘sigchld_handler’
bash-5.3/jobs.c:4037:7: warning[-Wunused-but-set-variable=]: variable ‘n’ set but not used
# 4037 | int n, oerrno;
# | ^
# 4035| sigchld_handler (int sig)
# 4036| {
# 4037|-> int n, oerrno;
# 4038|
# 4039| oerrno = errno;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/jobs.c: scope_hint: At top level
bash-5.3/jobs.c:5038:1: warning[-Wunused-function]: ‘maybe_give_terminal_to’ defined but not used
# 5038 | maybe_give_terminal_to (pid_t opgrp, pid_t npgrp, int flags)
# | ^~~~~~~~~~~~~~~~~~~~~~
# 5036| flags to pass to give_terminal_to(). */
# 5037| static int
# 5038|-> maybe_give_terminal_to (pid_t opgrp, pid_t npgrp, int flags)
# 5039| {
# 5040| int tpgrp;
Error: COMPILER_WARNING:
bash-5.3/jobs.c: scope_hint: In function ‘unfreeze_jobs_list’
bash-5.3/jobs.c:5296:7: warning[-Wunused-but-set-variable=]: variable ‘o’ set but not used
# 5296 | int o;
# | ^
# 5294| unfreeze_jobs_list (void)
# 5295| {
# 5296|-> int o;
# 5297|
# 5298| o = jobs_list_frozen;
Error: COMPILER_WARNING:
bash-5.3/lib/glob/glob.c:193:27: warning[-Wunused-but-set-variable=]: variable ‘nullpat’ set but not used
# 193 | int n, r, negate, wild, nullpat, xflags;
# | ^~~~~~~
# 191| {
# 192| char *pp, *pe, *t, *se;
# 193|-> int n, r, negate, wild, nullpat, xflags;
# 194|
# 195| negate = *pat == '!';
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/glob/glob.c: scope_hint: In function ‘extglob_skipname’
bash-5.3/lib/glob/glob.c:226:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 226 | while (t = glob_patscan (pp, pe, '|', 0))
# | ^
# 224|
# 225| /* check every subpattern */
# 226|-> while (t = glob_patscan (pp, pe, '|', 0))
# 227| {
# 228| /* If T == PE and *T == 0 (&& PE[-1] == RPAREN), we have hit the end
Error: COMPILER_WARNING (CWE-457):
bash-5.3/lib/glob/glob.c:246:12: warning[-Wmaybe-uninitialized]: ‘r’ may be used uninitialized
# 246 | return r;
# | ^
bash-5.3/lib/glob/glob.c: scope_hint: In function ‘skipname.isra.0’
bash-5.3/lib/glob/glob.c:193:10: note: ‘r’ was declared here
# 193 | int n, r, negate, wild, nullpat, xflags;
# | ^
# 244| /* glob_patscan might find end of string */
# 245| if (pp == se)
# 246|-> return r;
# 247|
# 248| /* but if it doesn't then we didn't match a leading dot */
Error: COMPILER_WARNING:
bash-5.3/lib/glob/glob.c:333:24: warning[-Wunused-but-set-variable=]: variable ‘nullpat’ set but not used
# 333 | int r, negate, wild, nullpat, xflags;
# | ^~~~~~~
# 331| #if EXTENDED_GLOB
# 332| wchar_t *pp, *pe, *t, *se, n;
# 333|-> int r, negate, wild, nullpat, xflags;
# 334|
# 335| negate = *pat == L'!';
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/glob/glob.c: scope_hint: In function ‘wextglob_skipname’
bash-5.3/lib/glob/glob.c:363:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 363 | while (t = glob_patscan_wc (pp, pe, '|', 0))
# | ^
# 361|
# 362| /* check every subpattern */
# 363|-> while (t = glob_patscan_wc (pp, pe, '|', 0))
# 364| {
# 365| n = t[-1]; /* ( */
Error: CPPCHECK_WARNING (CWE-758):
bash-5.3/lib/glob/glob.c:1388: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index.
# 1386| array = glob_dir_to_array (directories[i], temp_results, flags);
# 1387| l = 0;
# 1388|-> while (array[l] != NULL)
# 1389| ++l;
# 1390|
Error: CPPCHECK_WARNING (CWE-758):
bash-5.3/lib/glob/glob.c:1395: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index.
# 1393| if (new_result == NULL)
# 1394| {
# 1395|-> for (l = 0; array[l]; ++l)
# 1396| free (array[l]);
# 1397| free ((char *)array);
Error: CPPCHECK_WARNING (CWE-758):
bash-5.3/lib/glob/glob.c:1396: warning[objectIndex]: The address of variable 'glob_error_return' might be accessed at non-zero index.
# 1394| {
# 1395| for (l = 0; array[l]; ++l)
# 1396|-> free (array[l]);
# 1397| free ((char *)array);
# 1398| goto memory_error;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/glob/gmisc.c:57: included_from: Included from here.
bash-5.3/lib/glob/gm_loop.c: scope_hint: In function ‘umatchlen’
bash-5.3/lib/glob/gm_loop.c:80:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 80 | while (c = *pat++)
# | ^
# 78|
# 79| matlen = in_cclass = in_collsym = in_equiv = 0;
# 80|-> while (c = *pat++)
# 81| {
# 82| switch (c)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/glob/smatch.c:335: included_from: Included from here.
bash-5.3/lib/glob/sm_loop.c: scope_hint: In function ‘brackmatch’
bash-5.3/lib/glob/sm_loop.c:417:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 417 | if (not = (*p == L('!') || *p == L('^')))
# | ^~~
# 415| expression starting with an unquoted circumflex character produces
# 416| unspecified results. This implementation treats the two identically. */
# 417|-> if (not = (*p == L('!') || *p == L('^')))
# 418| ++p;
# 419|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/glob/sm_loop.c: scope_hint: In function ‘glob_patscan’
bash-5.3/lib/glob/sm_loop.c:687:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 687 | for (s = string; c = *s; s++)
# | ^
# 685| return (NULL);
# 686|
# 687|-> for (s = string; c = *s; s++)
# 688| {
# 689| if (s >= end)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/glob/sm_loop.c: scope_hint: In function ‘extmatch’
bash-5.3/lib/glob/sm_loop.c:898:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 898 | if (m1 = (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0))
# | ^~
# 896| pnext = PATSCAN (psub, pe, L('|'), flags);
# 897| /* If one of the patterns matches, just bail immediately. */
# 898|-> if (m1 = (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0))
# 899| break;
# 900| if (pnext == prest)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/glob/smatch.c: scope_hint: In function ‘posix_cclass_only’
bash-5.3/lib/glob/smatch.c:519:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 519 | while (p = strchr (p, '['))
# | ^
# 517|
# 518| p = pattern;
# 519|-> while (p = strchr (p, '['))
# 520| {
# 521| if (p[1] != ':')
Error: CPPCHECK_WARNING (CWE-456):
bash-5.3/lib/glob/xmbsrtowcs.c:90: error[uninitdata]: Memory is allocated but not initialized: wsbuf
# 88| psbuf = *ps;
# 89|
# 90|-> wclength = mbsrtowcs (wsbuf, &mbs, n, &psbuf);
# 91|
# 92| if (wsbuf)
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/lib/glob/xmbsrtowcs.c:221:11: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘wsbuf’
bash-5.3/lib/glob/xmbsrtowcs.c:182:10: branch_false: following ‘false’ branch (when ‘wcslength != 0’)...
bash-5.3/lib/glob/xmbsrtowcs.c:190:10: branch_false: ...to here
bash-5.3/lib/glob/xmbsrtowcs.c:190:10: branch_false: following ‘false’ branch (when ‘wcslength != 18446744073709551615’)...
bash-5.3/lib/glob/xmbsrtowcs.c:198:24: branch_false: ...to here
bash-5.3/lib/glob/xmbsrtowcs.c:198:10: branch_false: following ‘false’ branch...
bash-5.3/lib/glob/xmbsrtowcs.c:217:11: branch_false: ...to here
bash-5.3/lib/glob/xmbsrtowcs.c:219:10: branch_true: following ‘true’ branch...
bash-5.3/lib/glob/xmbsrtowcs.c:221:11: danger: dereference of NULL ‘wsbuf + wcnum * 4’
# 219| if (n == 0 && p == 0)
# 220| {
# 221|-> wsbuf[wcnum] = L'\0';
# 222| break;
# 223| }
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/glob/xmbsrtowcs.c: scope_hint: In function ‘xwcsrtombs’
bash-5.3/lib/glob/xmbsrtowcs.c:448:1: warning[-Wunused-label]: label ‘handle_byte’ defined but not used
# 448 | handle_byte:
# | ^~~~~~~~~~~
# 446| treat invalid wide character sequences as bytes. This is
# 447| intended to be symmetric with xdupmbstowcs2. */
# 448|-> handle_byte:
# 449| destptr = tmp_dest; /* in case wcrtomb modified it */
# 450| uc = wc;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/bind.c: scope_hint: In function ‘_rl_skip_to_delim’
bash-5.3/lib/readline/bind.c:1566:29: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1566 | for (i = start,passc = 0; c = string[i]; i++)
# | ^
# 1564| int i, c, passc;
# 1565|
# 1566|-> for (i = start,passc = 0; c = string[i]; i++)
# 1567| {
# 1568| if (passc)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/bind.c: scope_hint: In function ‘rl_function_dumper’
bash-5.3/lib/readline/bind.c:2810:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2810 | for (i = 0; name = names[i]; i++)
# | ^~~~
# 2808| fprintf (rl_outstream, "\n");
# 2809|
# 2810|-> for (i = 0; name = names[i]; i++)
# 2811| rl_print_keybinding (name, _rl_keymap, print_readably);
# 2812|
Error: COMPILER_WARNING (CWE-457):
bash-5.3/lib/readline/complete.c: scope_hint: In function ‘print_filename’
bash-5.3/lib/readline/complete.c:1101:22: warning[-Wmaybe-uninitialized]: ‘printed_len’ may be used uninitialized
# 1101 | printed_len++;
# | ~~~~~~~~~~~^~
bash-5.3/lib/readline/complete.c:994:7: note: ‘printed_len’ was declared here
# 994 | int printed_len, extension_char, slen, tlen;
# | ^~~~~~~~~~~
# 1099| {
# 1100| putc (extension_char, rl_outstream);
# 1101|-> printed_len++;
# 1102| }
# 1103| }
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/lib/readline/complete.c:1105:10: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘printed_len’
bash-5.3/lib/readline/complete.c:3057:1: enter_function: entry to ‘_rl_export_completions’
bash-5.3/lib/readline/complete.c:3061:9: call_function: calling ‘vector_len’ from ‘_rl_export_completions’
bash-5.3/lib/readline/complete.c:3061:9: return_function: returning to ‘_rl_export_completions’ from ‘vector_len’
bash-5.3/lib/readline/complete.c:3068:15: branch_true: following ‘true’ branch...
bash-5.3/lib/readline/complete.c:3070:42: branch_true: ...to here
bash-5.3/lib/readline/complete.c:3070:7: call_function: calling ‘print_filename’ from ‘_rl_export_completions’
# 1103| }
# 1104|
# 1105|-> return printed_len;
# 1106| }
# 1107|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/complete.c: scope_hint: In function ‘_rl_find_completion_word’
bash-5.3/lib/readline/complete.c:1209:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1209 | while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
# | ^~~~~~~~
# 1207| completion, so use the word break characters to find the
# 1208| substring on which to complete. */
# 1209|-> while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
# 1210| {
# 1211| scan = rl_line_buffer[rl_point];
Error: CPPCHECK_WARNING (CWE-562):
bash-5.3/lib/readline/complete.c:1337: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1335| {
# 1336| xfree (matches[i]);
# 1337|-> matches[i] = (char *)&dead_slot;
# 1338| }
# 1339| else
Error: COMPILER_WARNING (CWE-457):
bash-5.3/lib/readline/complete.c: scope_hint: In function ‘rl_complete_internal’
bash-5.3/lib/readline/complete.c:2178:14: warning[-Wmaybe-uninitialized]: ‘tlen’ may be used uninitialized
# 2178 | if (mlen >= tlen)
# | ^
bash-5.3/lib/readline/complete.c:2077:7: note: ‘tlen’ was declared here
# 2077 | int tlen, mlen, saved_last_completion_failed;
# | ^~~~
# 2176| {
# 2177| mlen = *matches[0] ? strlen (matches[0]) : 0;
# 2178|-> if (mlen >= tlen)
# 2179| insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char);
# 2180| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/complete.c: scope_hint: In function ‘rl_completion_matches’
bash-5.3/lib/readline/complete.c:2330:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2330 | while (string = (*entry_function) (text, matches))
# | ^~~~~~
# 2328| match_list[1] = (char *)NULL;
# 2329|
# 2330|-> while (string = (*entry_function) (text, matches))
# 2331| {
# 2332| if (RL_SIG_RECEIVED ())
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/complete.c: scope_hint: In function ‘rl_username_completion_function’
bash-5.3/lib/readline/complete.c:2399:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2399 | while (entry = getpwent ())
# | ^~~~~
# 2397| }
# 2398|
# 2399|-> while (entry = getpwent ())
# 2400| {
# 2401| /* Null usernames should result in all users as possible completions. */
Error: COMPILER_WARNING:
bash-5.3/lib/readline/display.c: scope_hint: In function ‘rl_redisplay’
bash-5.3/lib/readline/display.c:812:29: warning[-Wunused-but-set-variable=]: variable ‘num’ set but not used
# 812 | int newlines, lpos, temp, num;
# | ^~~
# 810| int in, out, c, linenum, cursor_linenum;
# 811| int inv_botlin, lb_botlin, lb_linenum, o_cpos;
# 812|-> int newlines, lpos, temp, num;
# 813| char *prompt_this_line;
# 814| char cur_face;
Error: COMPILER_WARNING (CWE-457):
bash-5.3/lib/readline/display.c: scope_hint: In function ‘rl_redisplay’
bash-5.3/lib/readline/display.c:1489:42: warning[-Wmaybe-uninitialized]: ‘physpos’ may be used uninitialized
# 1489 | _rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);
# | ^
bash-5.3/lib/readline/display.c:1474:19: note: ‘physpos’ was declared here
# 1474 | int physpos;
# | ^~~~~~~
# 1487| for invisible characters. */
# 1488| if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == prompt_last_screen_line)
# 1489|-> _rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);
# 1490| }
# 1491|
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/readline/display.c: scope_hint: At top level
bash-5.3/lib/readline/display.c:3363:1: warning[-Wunused-function]: ‘insert_some_chars’ defined but not used
# 3363 | insert_some_chars (char *string, int count, int col)
# | ^~~~~~~~~~~~~~~~~
# 3361| /* Insert COUNT characters from STRING to the output stream at column COL. */
# 3362| static void
# 3363|-> insert_some_chars (char *string, int count, int col)
# 3364| {
# 3365| open_some_spaces (col);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/histexpand.c: scope_hint: In function ‘get_history_event’
bash-5.3/lib/readline/histexpand.c:212:25: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 212 | for (local_index = i; c = string[i]; i++)
# | ^
# 210|
# 211| /* Only a closing `?' or a newline delimit a substring search string. */
# 212|-> for (local_index = i; c = string[i]; i++)
# 213| {
# 214| #if defined (HANDLE_MULTIBYTE)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/readline/histfile.c: scope_hint: At top level
bash-5.3/lib/readline/histfile.c:142:14: warning[-Wunused-function]: ‘history_backupfile’ declared ‘static’ but never defined
# 142 | static char *history_backupfile (const char *);
# | ^~~~~~~~~~~~~~~~~~
# 140| #define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((unsigned char)(s)[1]) )
# 141|
# 142|-> static char *history_backupfile (const char *);
# 143| static char *history_tempfile (const char *);
# 144| static int histfile_backup (const char *, const char *);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/readline/histfile.c:144:12: warning[-Wunused-function]: ‘histfile_backup’ declared ‘static’ but never defined
# 144 | static int histfile_backup (const char *, const char *);
# | ^~~~~~~~~~~~~~~
# 142| static char *history_backupfile (const char *);
# 143| static char *history_tempfile (const char *);
# 144|-> static int histfile_backup (const char *, const char *);
# 145| static int histfile_restore (const char *, const char *);
# 146| static int history_rename (const char *, const char *);
Error: COMPILER_WARNING:
bash-5.3/lib/readline/histfile.c: scope_hint: In function ‘history_truncate_file’
bash-5.3/lib/readline/histfile.c:543:49: warning[-Wunused-but-set-variable=]: variable ‘r’ set but not used
# 543 | int file, chars_read, rv, orig_lines, exists, r;
# | ^
# 541| {
# 542| char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */
# 543|-> int file, chars_read, rv, orig_lines, exists, r;
# 544| struct stat finfo, nfinfo;
# 545| size_t file_size;
Error: GCC_ANALYZER_WARNING (CWE-1341):
bash-5.3/lib/readline/histfile.c:687:22: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘open(history_tempfile(history_filename(fname)), 577, 384)’
bash-5.3/lib/readline/histfile.c:551:6: branch_false: following ‘false’ branch...
bash-5.3/lib/readline/histfile.c:554:10: branch_false: ...to here
bash-5.3/lib/readline/histfile.c:560:6: branch_false: following ‘false’ branch...
bash-5.3/lib/readline/histfile.c:572:6: branch_false: following ‘false’ branch...
bash-5.3/lib/readline/histfile.c:583:23: branch_false: ...to here
bash-5.3/lib/readline/histfile.c:586:7: branch_false: following ‘false’ branch (when ‘file_size != 18446744073709551615’)...
bash-5.3/lib/readline/histfile.c:599:20: branch_false: ...to here
bash-5.3/lib/readline/histfile.c:600:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
bash-5.3/lib/readline/histfile.c:608:6: branch_false: ...to here
bash-5.3/lib/readline/histfile.c:673:6: branch_true: following ‘true’ branch...
bash-5.3/lib/readline/histfile.c:675:28: branch_true: ...to here
bash-5.3/lib/readline/histfile.c:681:11: branch_true: following ‘true’ branch...
bash-5.3/lib/readline/histfile.c:683:16: branch_true: ...to here
bash-5.3/lib/readline/histfile.c:684:11: release_resource: first ‘close’ here
bash-5.3/lib/readline/histfile.c:687:10: branch_true: following ‘true’ branch (when ‘rv == 0’)...
bash-5.3/lib/readline/histfile.c:687:22: branch_true: ...to here
bash-5.3/lib/readline/histfile.c:687:22: danger: second ‘close’ here; first ‘close’ was at [(15)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/14)
# 685| }
# 686|
# 687|-> if (rv == 0 && close (file) < 0)
# 688| rv = errno;
# 689| }
Error: GCC_ANALYZER_WARNING (CWE-122):
bash-5.3/lib/readline/histfile.c:866:13: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
bash-5.3/lib/readline/histfile.c:785:10: branch_true: following ‘true’ branch (when ‘output’ is non-NULL)...
bash-5.3/lib/readline/histfile.c:785:19: branch_true: ...to here
bash-5.3/lib/readline/histfile.c:788:6: branch_false: following ‘false’ branch...
bash-5.3/lib/readline/histfile.c:800:7: branch_false: ...to here
bash-5.3/lib/readline/histfile.c:813:59: branch_false: following ‘false’ branch...
bash-5.3/lib/readline/histfile.c:844:22: branch_false: ...to here
bash-5.3/lib/readline/histfile.c:845:8: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
bash-5.3/lib/readline/histfile.c:860:14: branch_false: ...to here
bash-5.3/lib/readline/histfile.c:860:42: branch_true: following ‘true’ branch...
bash-5.3/lib/readline/histfile.c:862:13: branch_true: ...to here
bash-5.3/lib/readline/histfile.c:862:12: branch_true: following ‘true’ branch...
bash-5.3/lib/readline/histfile.c:866:13: danger: out-of-bounds write
# 864| strcpy (buffer + j, the_history[i]->timestamp);
# 865| j += strlen (the_history[i]->timestamp);
# 866|-> buffer[j++] = '\n';
# 867| }
# 868| strcpy (buffer + j, the_history[i]->line);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/histsearch.c: scope_hint: In function ‘_hs_history_patsearch’
bash-5.3/lib/readline/histsearch.c:258:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 258 | if (unescaped_backslash = (string[ret] == '\\'))
# | ^~~~~~~~~~~~~~~~~~~
# 256| /* fnmatch is required to reject a pattern that ends with an unescaped
# 257| backslash */
# 258|-> if (unescaped_backslash = (string[ret] == '\\'))
# 259| {
# 260| while (ret > 0 && string[--ret] == '\\')
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/input.c: scope_hint: In function ‘rl_read_key’
bash-5.3/lib/readline/input.c:794:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 794 | if (c = _rl_next_macro_key ())
# | ^
# 792| {
# 793| /* If input is coming from a macro, then use that. */
# 794|-> if (c = _rl_next_macro_key ())
# 795| return ((unsigned char)c);
# 796|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/readline/input.c: scope_hint: In function ‘rl_getc’
bash-5.3/lib/readline/input.c:839:12: warning[-Wunused-variable]: unused variable ‘empty_set’
# 839 | sigset_t empty_set;
# | ^~~~~~~~~
# 837| int fd;
# 838| #if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
# 839|-> sigset_t empty_set;
# 840| fd_set readfds;
# 841| #endif
Error: COMPILER_WARNING:
bash-5.3/lib/readline/isearch.c: scope_hint: In function ‘rl_search_history’
bash-5.3/lib/readline/isearch.c:912:7: warning[-Wunused-but-set-variable=]: variable ‘c’ set but not used
# 912 | int c, r;
# | ^
# 910| {
# 911| _rl_search_cxt *cxt; /* local for now, but saved globally */
# 912|-> int c, r;
# 913|
# 914| RL_SETSTATE(RL_STATE_ISEARCH);
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.3/lib/readline/kill.c:202:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/lib/readline/kill.c:197:1: enter_function: entry to ‘rl_kill_word’
bash-5.3/lib/readline/kill.c:202:12: call_function: calling ‘rl_backward_kill_word’ from ‘rl_kill_word’
# 200|
# 201| if (count < 0)
# 202|-> return (rl_backward_kill_word (-count, key));
# 203| else
# 204| {
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.3/lib/readline/kill.c:225:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/lib/readline/kill.c:220:1: enter_function: entry to ‘rl_backward_kill_word’
bash-5.3/lib/readline/kill.c:225:12: call_function: calling ‘rl_kill_word’ from ‘rl_backward_kill_word’
# 223|
# 224| if (count < 0)
# 225|-> return (rl_kill_word (-count, key));
# 226| else
# 227| {
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.3/lib/readline/kill.c:494:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/lib/readline/kill.c:491:1: enter_function: entry to ‘rl_copy_forward_word’
bash-5.3/lib/readline/kill.c:494:12: call_function: calling ‘rl_copy_backward_word’ from ‘rl_copy_forward_word’
# 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.3/lib/readline/kill.c:503:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/lib/readline/kill.c:500:1: enter_function: entry to ‘rl_copy_backward_word’
bash-5.3/lib/readline/kill.c:503:12: call_function: calling ‘rl_copy_forward_word’ from ‘rl_copy_backward_word’
# 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-569):
bash-5.3/lib/readline/misc.c: scope_hint: In function ‘_rl_revert_previous_lines’
bash-5.3/lib/readline/misc.c:491:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 491 | if (ul = (UNDO_LIST *)entry->data)
# | ^~
# 489| while (entry)
# 490| {
# 491|-> if (ul = (UNDO_LIST *)entry->data)
# 492| {
# 493| if (ul == saved_undo_list)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/misc.c: scope_hint: In function ‘rl_clear_history’
bash-5.3/lib/readline/misc.c:551:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 551 | if (ul = (UNDO_LIST *)hent->data)
# | ^~
# 549| {
# 550| hent = hlist[i];
# 551|-> if (ul = (UNDO_LIST *)hent->data)
# 552| {
# 553| if (ul == saved_undo_list)
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.3/lib/readline/misc.c:623:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/lib/readline/misc.c:618:1: enter_function: entry to ‘rl_get_next_history’
bash-5.3/lib/readline/misc.c:623:12: call_function: calling ‘rl_get_previous_history’ from ‘rl_get_next_history’
# 621|
# 622| if (count < 0)
# 623|-> return (rl_get_previous_history (-count, key));
# 624|
# 625| if (count == 0)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/readline/nls.c:287:1: warning[-Wunused-function]: ‘find_codeset’ defined but not used
# 287 | find_codeset (char *name, size_t *lenp)
# | ^~~~~~~~~~~~
# 285| /* Isolate codeset portion of locale specification. */
# 286| static char *
# 287|-> find_codeset (char *name, size_t *lenp)
# 288| {
# 289| char *cp, *language, *result;
Error: COMPILER_WARNING:
bash-5.3/lib/readline/parens.c: scope_hint: In function ‘rl_insert_close’
bash-5.3/lib/readline/parens.c:115:36: warning[-Wunused-but-set-variable=]: variable ‘ready’ set but not used
# 115 | int orig_point, match_point, ready;
# | ^~~~~
# 113| {
# 114| #if defined (HAVE_SELECT)
# 115|-> int orig_point, match_point, ready;
# 116| struct timeval timer;
# 117| fd_set readfds;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/readline/readline.c:76: included_from: Included from here.
bash-5.3/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-1164):
bash-5.3/lib/readline/readline.c: scope_hint: At top level
bash-5.3/lib/readline/readline.c:99:13: warning[-Wunused-function]: ‘reset_default_bindings’ declared ‘static’ but never defined
# 99 | static void reset_default_bindings (void);
# | ^~~~~~~~~~~~~~~~~~~~~~
# 97|
# 98| static void readline_default_bindings (void);
# 99|-> static void reset_default_bindings (void);
# 100|
# 101| static int _rl_subseq_result (int, Keymap, int, int);
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/readline/readline.c:577:21: warning[-Wunused-variable]: unused variable ‘eof_found’
# 577 | static int lastc, eof_found;
# | ^~~~~~~~~
# 575| #endif
# 576| {
# 577|-> static int lastc, eof_found;
# 578| int c, code, lk, r;
# 579| static procenv_t olevel;
Error: COMPILER_WARNING:
bash-5.3/lib/readline/readline.c: scope_hint: In function ‘readline_internal_char’
bash-5.3/lib/readline/readline.c:578:20: warning[-Wunused-but-set-variable=]: variable ‘r’ set but not used
# 578 | int c, code, lk, r;
# | ^
# 576| {
# 577| static int lastc, eof_found;
# 578|-> int c, code, lk, r;
# 579| static procenv_t olevel;
# 580|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/readline/signals.c: scope_hint: In function ‘rl_set_signals’
bash-5.3/lib/readline/signals.c:422:25: warning[-Wunused-variable]: unused variable ‘oset’
# 422 | static sigset_t bset, oset;
# | ^~~~
# 420| #if defined (HAVE_POSIX_SIGNALS)
# 421| static int sigmask_set = 0;
# 422|-> static sigset_t bset, oset;
# 423| #endif
# 424|
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/lib/readline/text.c:101:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘string’
bash-5.3/lib/readline/text.c:2358:1: enter_function: entry to ‘rl_execute_named_command’
bash-5.3/lib/readline/text.c:2364:13: call_function: calling ‘_rl_read_command_name’ from ‘rl_execute_named_command’
# 99| rl_line_buffer[i + l] = rl_line_buffer[i];
# 100|
# 101|-> strncpy (rl_line_buffer + rl_point, string, l);
# 102|
# 103| /* Remember how to undo this if we aren't undoing something. */
Error: COMPILER_WARNING:
bash-5.3/lib/readline/text.c: scope_hint: In function ‘rl_insert_text’
bash-5.3/lib/readline/text.c:101:3: warning[-Wstringop-truncation]: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length
# 101 | strncpy (rl_line_buffer + rl_point, string, l);
# | ^
bash-5.3/lib/readline/text.c:91:29: note: length computed here
# 91 | l = (string && *string) ? strlen (string) : 0;
# | ^~~~~~~~~~~~~~~
# 99| rl_line_buffer[i + l] = rl_line_buffer[i];
# 100|
# 101|-> strncpy (rl_line_buffer + rl_point, string, l);
# 102|
# 103| /* Remember how to undo this if we aren't undoing something. */
Error: GCC_ANALYZER_WARNING (CWE-674):
bash-5.3/lib/readline/text.c:397:12: warning[-Wanalyzer-infinite-recursion]: infinite recursion
bash-5.3/lib/readline/text.c:394:1: enter_function: entry to ‘rl_backward_byte’
bash-5.3/lib/readline/text.c:397:12: call_function: calling ‘rl_forward_byte’ from ‘rl_backward_byte’
# 395| {
# 396| if (count < 0)
# 397|-> return (rl_forward_byte (-count, key));
# 398|
# 399| if (count > 0)
Error: COMPILER_WARNING:
bash-5.3/lib/readline/text.c: scope_hint: In function ‘rl_insert’
bash-5.3/lib/readline/text.c:987:13: warning[-Wunused-but-set-variable=]: variable ‘x’ set but not used
# 987 | int r, n, x;
# | ^
# 985| rl_insert (int count, int c)
# 986| {
# 987|-> int r, n, x;
# 988|
# 989| r = (rl_insert_mode == RL_IM_INSERT) ? _rl_insert_char (count, c) : _rl_overwrite_char (count, c);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/readline/tilde.c:188:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 188 | if (result = strchr (string, '~'))
# | ^~~~~~
# 186|
# 187| result_index = result_size = 0;
# 188|-> if (result = strchr (string, '~'))
# 189| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 190| else
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/readline/tilde.c: scope_hint: In function ‘tilde_expand’
bash-5.3/lib/readline/tilde.c:188:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 188 | if (result = strchr (string, '~'))
# | ^
# 186|
# 187| result_index = result_size = 0;
# 188|-> if (result = strchr (string, '~'))
# 189| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 190| else
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/readline/tilde.c:188:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 186|
# 187| result_index = result_size = 0;
# 188|-> if (result = strchr (string, '~'))
# 189| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 190| else
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/lib/readline/undo.c:156: warning[uninitvar]: Uninitialized variable: roving
# 154| else
# 155| {
# 156|-> roving->next = c;
# 157| roving = roving->next;
# 158| }
Error: COMPILER_WARNING:
bash-5.3/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_fword’
bash-5.3/lib/readline/vi_mode.c:625:7: warning[-Wunused-but-set-variable=]: variable ‘opoint’ set but not used
# 625 | int opoint;
# | ^~~~~~
# 623| rl_vi_fword (int count, int ignore)
# 624| {
# 625|-> int opoint;
# 626|
# 627| while (count-- && rl_point < (rl_end - 1))
Error: COMPILER_WARNING:
bash-5.3/lib/readline/vi_mode.c: scope_hint: In function ‘rl_vi_change_char’
bash-5.3/lib/readline/vi_mode.c:2125:7: warning[-Wstringop-truncation]: ‘strncpy’ output may be truncated copying 16 bytes from a string of length 16
# 2125 | strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX);
# | ^
# 2123| if (_rl_vi_redoing)
# 2124| {
# 2125|-> strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX);
# 2126| c = (unsigned char)_rl_vi_last_replacement[0]; /* XXX */
# 2127| mb[MB_LEN_MAX] = '\0';
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/anonfile.c: scope_hint: In function ‘anonopen’
bash-5.3/lib/sh/anonfile.c:76:9: warning[-Wunused-variable]: unused variable ‘fname’
# 76 | char *fname;
# | ^~~~~
# 74| {
# 75| int fd, flag;
# 76|-> char *fname;
# 77|
# 78| #if defined (HAVE_MEMFD_CREATE)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/anonfile.c: scope_hint: At top level
bash-5.3/lib/sh/anonfile.c:114:1: warning[-Wunused-function]: ‘anonunlink’ defined but not used
# 114 | anonunlink (const char *fn)
# | ^~~~~~~~~~
# 112|
# 113| static int
# 114|-> anonunlink (const char *fn)
# 115| {
# 116| int r;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/casemod.c: scope_hint: In function ‘sh_modcase’
bash-5.3/lib/sh/casemod.c:102:15: warning[-Wunused-variable]: unused variable ‘c’
# 102 | int inword, c, nc, nop, match, usewords;
# | ^
# 100| {
# 101| int start, next, end, retind;
# 102|-> int inword, c, nc, nop, match, usewords;
# 103| char *ret, *s;
# 104| wchar_t wc;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/eaccess.c:171:1: warning[-Wunused-function]: ‘sh_euidaccess’ defined but not used
# 171 | sh_euidaccess (const char *path, int mode)
# | ^~~~~~~~~~~~~
# 169| the effective and real uid and gid as appropriate. */
# 170| static int
# 171|-> sh_euidaccess (const char *path, int mode)
# 172| {
# 173| int r, e;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/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.3/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 (void);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/fnxform.c:80:1: warning[-Wunused-function]: ‘init_tofs’ defined but not used
# 80 | init_tofs (void)
# | ^~~~~~~~~
# 78|
# 79| static void
# 80|-> init_tofs (void)
# 81| {
# 82| char *cur;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/fnxform.c:89:1: warning[-Wunused-function]: ‘init_fromfs’ defined but not used
# 89 | init_fromfs (void)
# | ^~~~~~~~~~~
# 87|
# 88| static void
# 89|-> init_fromfs (void)
# 90| {
# 91| char *cur;
Error: COMPILER_WARNING:
bash-5.3/lib/sh/getenv.c: scope_hint: In function ‘getenv’
bash-5.3/lib/sh/getenv.c:54:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘name’ compared to NULL
# 54 | if (name == 0 || *name == '\0')
# | ^
# 52| SHELL_VAR *var;
# 53|
# 54|-> if (name == 0 || *name == '\0')
# 55| return ((char *)NULL);
# 56|
Error: COMPILER_WARNING:
bash-5.3/lib/sh/getenv.c: scope_hint: In function ‘putenv’
bash-5.3/lib/sh/getenv.c:106:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘str’ compared to NULL
# 106 | if (str == 0 || *str == '\0')
# | ^
# 104| int offset;
# 105|
# 106|-> if (str == 0 || *str == '\0')
# 107| {
# 108| errno = EINVAL;
Error: COMPILER_WARNING:
bash-5.3/lib/sh/getenv.c: scope_hint: In function ‘unsetenv’
bash-5.3/lib/sh/getenv.c:189:6: warning[-Wnonnull-compare]: ‘nonnull’ argument ‘name’ compared to NULL
# 189 | if (name == 0 || *name == '\0' || strchr (name, '=') != 0)
# | ^
# 187| unsetenv (const char *name)
# 188| {
# 189|-> if (name == 0 || *name == '\0' || strchr (name, '=') != 0)
# 190| {
# 191| errno = EINVAL;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/sh/makepath.c: scope_hint: In function ‘sh_makepath’
bash-5.3/lib/sh/makepath.c:117:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 117 | while (*r++ = *s++)
# | ^
# 115| *r++ = '/';
# 116| s = xdir;
# 117|-> while (*r++ = *s++)
# 118| ;
# 119| if (xpath != path && xpath != nullpath)
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/sh/mbschr.c: scope_hint: In function ‘mbschr’
bash-5.3/lib/sh/mbschr.c:84:11: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 84 | return (strchr (s, c));
# | ^~~~~~
# 82| else
# 83| #endif
# 84|-> return (strchr (s, c));
# 85| }
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/sh/mbschr.c:84:11: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 82| else
# 83| #endif
# 84|-> return (strchr (s, c));
# 85| }
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/lib/sh/netopen.c:228:14: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘<unknown>’
bash-5.3/lib/sh/netopen.c:221:6: branch_false: following ‘false’ branch...
bash-5.3/lib/sh/netopen.c:231:8: branch_false: ...to here
bash-5.3/lib/sh/netopen.c:231:20: branch_false: following ‘false’ branch (when ‘res’ is NULL)...
bash-5.3/lib/sh/netopen.c:228:14: branch_false: ...to here
bash-5.3/lib/sh/netopen.c:228:14: danger: use of uninitialized value ‘<unknown>’ here
# 226| internal_error ("%s: %s", host, gai_strerror (gerr));
# 227| errno = EINVAL;
# 228|-> return -1;
# 229| }
# 230|
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/lib/sh/netopen.c:258: warning[uninitvar]: Uninitialized variable: s
# 256| break;
# 257| }
# 258|-> return s;
# 259| }
# 260| #endif /* HAVE_GETADDRINFO */
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/sh/pathcanon.c: scope_hint: In function ‘sh_canonpath’
bash-5.3/lib/sh/pathcanon.c:113:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 113 | if (rooted = ROOTEDPATH(path))
# | ^~~~~~
# 111| /* POSIX.2 says to leave a leading `//' alone. On cygwin, we skip over any
# 112| leading `x:' (dos drive name). */
# 113|-> if (rooted = ROOTEDPATH(path))
# 114| {
# 115| stub_char = DIRSEP;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/random.c:141:1: warning[-Wunused-function]: ‘brand32’ defined but not used
# 141 | brand32 (void)
# | ^~~~~~~
# 139| /* Returns a 32-bit pseudo-random number between 0 and 4294967295. */
# 140| static u_bits32_t
# 141|-> brand32 (void)
# 142| {
# 143| u_bits32_t ret;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/random.c: scope_hint: In function ‘brand32’
bash-5.3/lib/sh/random.c:143:14: warning[-Wunused-variable]: unused variable ‘ret’
# 143 | u_bits32_t ret;
# | ^~~
# 141| brand32 (void)
# 142| {
# 143|-> u_bits32_t ret;
# 144|
# 145| rseed32 = intrand32 (rseed32);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/random.c: scope_hint: At top level
bash-5.3/lib/sh/random.c:165:1: warning[-Wunused-function]: ‘perturb_rand32’ defined but not used
# 165 | perturb_rand32 (void)
# | ^~~~~~~~~~~~~~
# 163|
# 164| static void
# 165|-> perturb_rand32 (void)
# 166| {
# 167| rseed32 ^= genseed ();
Error: COMPILER_WARNING (CWE-563):
bash-5.3/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.3/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: COMPILER_WARNING (CWE-569):
bash-5.3/lib/sh/shmatch.c: scope_hint: In function ‘sh_regmatch’
bash-5.3/lib/sh/shmatch.c:86:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 86 | if (reg_err = regcomp (®ex, pattern, rflags))
# | ^~~~~~~
# 84| #endif
# 85|
# 86|-> if (reg_err = regcomp (®ex, pattern, rflags))
# 87| {
# 88| if (errbuf)
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/lib/sh/spell.c:78:37: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘newname[1]’
bash-5.3/lib/sh/spell.c:185:1: enter_function: entry to ‘dirspell’
bash-5.3/lib/sh/spell.c:192:6: branch_false: following ‘false’ branch (when ‘guess’ is non-NULL)...
bash-5.3/lib/sh/spell.c:195:11: branch_false: ...to here
bash-5.3/lib/sh/spell.c:195:11: call_function: calling ‘spname’ from ‘dirspell’
# 76| {
# 77| /* `.' is rarely the right thing. */
# 78|-> if (oldname[1] == '\0' && newname[1] == '\0' &&
# 79| oldname[0] != '.' && newname[0] == '.')
# 80| return -1;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/sh/spell.c: scope_hint: In function ‘spname’
bash-5.3/lib/sh/spell.c:96:22: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 96 | for (p = best; *np = *p++; np++)
# | ^
# 94| * Add to end of newname
# 95| */
# 96|-> for (p = best; *np = *p++; np++)
# 97| ;
# 98| }
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/lib/sh/stringlist.c:126:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.3/lib/sh/stringlist.c:114:1: enter_function: entry to ‘strlist_copy’
bash-5.3/lib/sh/stringlist.c:119:6: branch_false: following ‘false’ branch (when ‘sl’ is non-NULL)...
bash-5.3/lib/sh/stringlist.c:121:9: branch_false: ...to here
bash-5.3/lib/sh/stringlist.c:121:9: call_function: calling ‘strlist_create’ from ‘strlist_copy’
bash-5.3/lib/sh/stringlist.c:121:9: return_function: returning to ‘strlist_copy’ from ‘strlist_create’
bash-5.3/lib/sh/stringlist.c:123:6: branch_true: following ‘true’ branch...
bash-5.3/lib/sh/stringlist.c:123:6: branch_true: ...to here
bash-5.3/lib/sh/stringlist.c:125:19: branch_true: following ‘true’ branch...
bash-5.3/lib/sh/stringlist.c:126:24: branch_true: ...to here
bash-5.3/lib/sh/stringlist.c:126:24: branch_false: following ‘false’ branch...
bash-5.3/lib/sh/stringlist.c:126:9: branch_false: ...to here
bash-5.3/lib/sh/stringlist.c:126:9: release_memory: using NULL here
bash-5.3/lib/sh/stringlist.c:126:9: danger: dereference of NULL ‘*<unknown>.list + (long unsigned int)i * 8’
# 124| {
# 125| for (i = 0; i < sl->list_size; i++)
# 126|-> new->list[i] = STRDUP (sl->list[i]);
# 127| }
# 128| new->list_size = sl->list_size;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/lib/sh/stringlist.c:149:5: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.3/lib/sh/stringlist.c:139:1: enter_function: entry to ‘strlist_merge’
bash-5.3/lib/sh/stringlist.c:147:8: call_function: calling ‘strlist_create’ from ‘strlist_merge’
bash-5.3/lib/sh/stringlist.c:147:8: return_function: returning to ‘strlist_merge’ from ‘strlist_create’
bash-5.3/lib/sh/stringlist.c:148:19: branch_true: following ‘true’ branch (when ‘i < l1’)...
bash-5.3/lib/sh/stringlist.c:149:19: branch_true: ...to here
bash-5.3/lib/sh/stringlist.c:149:19: branch_false: following ‘false’ branch...
bash-5.3/lib/sh/stringlist.c:149:5: branch_false: ...to here
bash-5.3/lib/sh/stringlist.c:149:5: release_memory: using NULL here
bash-5.3/lib/sh/stringlist.c:149:5: danger: dereference of NULL ‘*<unknown>.list + i * 8’
# 147| sl = strlist_create (l1 + l2 + 1);
# 148| for (i = n = 0; i < l1; i++, n++)
# 149|-> sl->list[n] = STRDUP (m1->list[i]);
# 150| for (i = 0; i < l2; i++, n++)
# 151| sl->list[n] = STRDUP (m2->list[i]);
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/lib/sh/stringlist.c:151:5: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.3/lib/sh/stringlist.c:139:1: enter_function: entry to ‘strlist_merge’
bash-5.3/lib/sh/stringlist.c:147:8: call_function: calling ‘strlist_create’ from ‘strlist_merge’
bash-5.3/lib/sh/stringlist.c:147:8: return_function: returning to ‘strlist_merge’ from ‘strlist_create’
bash-5.3/lib/sh/stringlist.c:148:19: branch_false: following ‘false’ branch (when ‘i >= l1’)...
bash-5.3/lib/sh/stringlist.c:148:19: branch_false: ...to here
bash-5.3/lib/sh/stringlist.c:150:15: branch_true: following ‘true’ branch (when ‘i < l2’)...
bash-5.3/lib/sh/stringlist.c:151:19: branch_true: ...to here
bash-5.3/lib/sh/stringlist.c:151:19: branch_false: following ‘false’ branch...
bash-5.3/lib/sh/stringlist.c:151:5: branch_false: ...to here
bash-5.3/lib/sh/stringlist.c:151:5: release_memory: using NULL here
bash-5.3/lib/sh/stringlist.c:151:5: danger: dereference of NULL ‘*<unknown>.list + n * 8’
# 149| sl->list[n] = STRDUP (m1->list[i]);
# 150| for (i = 0; i < l2; i++, n++)
# 151|-> sl->list[n] = STRDUP (m2->list[i]);
# 152| sl->list_len = n;
# 153| sl->list[n] = (char *)NULL;
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/lib/sh/stringlist.c:153:3: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
bash-5.3/lib/sh/stringlist.c:139:1: enter_function: entry to ‘strlist_merge’
bash-5.3/lib/sh/stringlist.c:147:8: call_function: calling ‘strlist_create’ from ‘strlist_merge’
bash-5.3/lib/sh/stringlist.c:147:8: return_function: returning to ‘strlist_merge’ from ‘strlist_create’
bash-5.3/lib/sh/stringlist.c:148:19: branch_false: following ‘false’ branch (when ‘i >= l1’)...
bash-5.3/lib/sh/stringlist.c:148:19: branch_false: ...to here
bash-5.3/lib/sh/stringlist.c:150:15: branch_false: following ‘false’ branch (when ‘i >= l2’)...
bash-5.3/lib/sh/stringlist.c:152:3: branch_false: ...to here
bash-5.3/lib/sh/stringlist.c:153:3: release_memory: using NULL here
bash-5.3/lib/sh/stringlist.c:153:3: danger: dereference of NULL ‘*<unknown>.list + n * 8’
# 151| sl->list[n] = STRDUP (m2->list[i]);
# 152| sl->list_len = n;
# 153|-> sl->list[n] = (char *)NULL;
# 154| return (sl);
# 155| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/sh/strtrans.c: scope_hint: In function ‘ansic_quote’
bash-5.3/lib/sh/strtrans.c:250:17: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 250 | for (s = str; c = *s; s++)
# | ^
# 248| *r++ = '\'';
# 249|
# 250|-> for (s = str; c = *s; s++)
# 251| {
# 252| switch (c)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/sh/strtrans.c: scope_hint: In function ‘ansic_wshouldquote’
bash-5.3/lib/sh/strtrans.c:327:21: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 327 | for (wcs = wcstr; wcc = *wcs; wcs++)
# | ^~~
# 325| mbstowcs (wcstr, string, slen + 1);
# 326|
# 327|-> for (wcs = wcstr; wcc = *wcs; wcs++)
# 328| if (iswprint(wcc) == 0)
# 329| {
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/sh/strtrans.c: scope_hint: In function ‘ansic_shouldquote’
bash-5.3/lib/sh/strtrans.c:349:20: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 349 | for (s = string; c = *s; s++)
# | ^
# 347| return 0;
# 348|
# 349|-> for (s = string; c = *s; s++)
# 350| {
# 351| #if defined (HANDLE_MULTIBYTE)
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/strvis.c: scope_hint: In function ‘sh_strvis’
bash-5.3/lib/sh/strvis.c:120:17: warning[-Wunused-variable]: unused variable ‘c’
# 120 | unsigned char c;
# | ^
# 118| char *ret;
# 119| size_t retind, retsize;
# 120|-> unsigned char c;
# 121| DECLARE_MBSTATE;
# 122|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/timers.c: scope_hint: In function ‘shtimer_select’
bash-5.3/lib/sh/timers.c:189:26: warning[-Wunused-variable]: unused variable ‘prevmask’
# 189 | sigset_t blocked_sigs, prevmask;
# | ^~~~~~~~
# 187| {
# 188| int r, nfd;
# 189|-> sigset_t blocked_sigs, prevmask;
# 190| struct timeval now, tv;
# 191| fd_set readfds;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/tmpfile.c:67:12: warning[-Wunused-variable]: ‘ntmpfiles’ defined but not used
# 67 | static int ntmpfiles;
# | ^~~~~~~~~
# 65|
# 66| static char *sys_tmpdir = (char *)NULL;
# 67|-> static int ntmpfiles;
# 68| static int tmpnamelen = -1;
# 69| static unsigned long filenum = 1L;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/tmpfile.c:69:22: warning[-Wunused-variable]: ‘filenum’ defined but not used
# 69 | static unsigned long filenum = 1L;
# | ^~~~~~~
# 67| static int ntmpfiles;
# 68| static int tmpnamelen = -1;
# 69|-> static unsigned long filenum = 1L;
# 70|
# 71| static char *
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/tmpfile.c: scope_hint: At top level
bash-5.3/lib/sh/tmpfile.c:123:1: warning[-Wunused-function]: ‘sh_seedrand’ defined but not used
# 123 | sh_seedrand (void)
# | ^~~~~~~~~~~
# 121|
# 122| static void
# 123|-> sh_seedrand (void)
# 124| {
# 125| #if HAVE_RANDOM
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/tmpfile.c:153:15: warning[-Wunused-variable]: unused variable ‘sb’
# 153 | struct stat sb;
# | ^~
# 151| char *filename, *tdir;
# 152| const char *lroot;
# 153|-> struct stat sb;
# 154| int r, tdlen;
# 155| static int seeded = 0;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/tmpfile.c:154:7: warning[-Wunused-variable]: unused variable ‘r’
# 154 | int r, tdlen;
# | ^
# 152| const char *lroot;
# 153| struct stat sb;
# 154|-> int r, tdlen;
# 155| static int seeded = 0;
# 156|
Error: COMPILER_WARNING:
bash-5.3/lib/sh/tmpfile.c:154:10: warning[-Wunused-but-set-variable=]: variable ‘tdlen’ set but not used
# 154 | int r, tdlen;
# | ^~~~~
# 152| const char *lroot;
# 153| struct stat sb;
# 154|-> int r, tdlen;
# 155| static int seeded = 0;
# 156|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpname’
bash-5.3/lib/sh/tmpfile.c:155:14: warning[-Wunused-variable]: unused variable ‘seeded’
# 155 | static int seeded = 0;
# | ^~~~~~
# 153| struct stat sb;
# 154| int r, tdlen;
# 155|-> static int seeded = 0;
# 156|
# 157| filename = (char *)xmalloc (PATH_MAX + 1);
Error: COMPILER_WARNING:
bash-5.3/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpfd’
bash-5.3/lib/sh/tmpfile.c:215:11: warning[-Wunused-but-set-variable=]: variable ‘tdlen’ set but not used
# 215 | int fd, tdlen;
# | ^~~~~
# 213| char *filename, *tdir;
# 214| const char *lroot;
# 215|-> int fd, tdlen;
# 216|
# 217| filename = (char *)xmalloc (PATH_MAX + 1);
Error: COMPILER_WARNING (CWE-563):
bash-5.3/lib/sh/tmpfile.c:312:7: warning[-Wunused-variable]: unused variable ‘fd’
# 312 | int fd;
# | ^~
# 310| {
# 311| char *filename;
# 312|-> int fd;
# 313| #ifdef USE_MKDTEMP
# 314| char *tdir, *dirname;
Error: COMPILER_WARNING:
bash-5.3/lib/sh/tmpfile.c: scope_hint: In function ‘sh_mktmpdir’
bash-5.3/lib/sh/tmpfile.c:316:7: warning[-Wunused-but-set-variable=]: variable ‘tdlen’ set but not used
# 316 | int tdlen;
# | ^~~~~
# 314| char *tdir, *dirname;
# 315| const char *lroot;
# 316|-> int tdlen;
# 317|
# 318| filename = (char *)xmalloc (PATH_MAX + 1);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/ufuncs.c:111:1: warning[-Wunused-function]: ‘ssleep’ defined but not used
# 111 | ssleep (unsigned int sec, unsigned int usec)
# | ^~~~~~
# 109| #if defined (HAVE_TIMEVAL) && (defined (HAVE_SELECT) || defined (HAVE_PSELECT))
# 110| static int
# 111|-> ssleep (unsigned int sec, unsigned int usec)
# 112| {
# 113| int e, r;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/lib/sh/unicode.c:74:1: warning[-Wunused-function]: ‘stub_charset’ defined but not used
# 74 | stub_charset (void)
# | ^~~~~~~~~~~~
# 72|
# 73| static char *
# 74|-> stub_charset (void)
# 75| {
# 76| char *locale, *s, *t;
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/sh/utf8.c: scope_hint: In function ‘utf8_mbschr’
bash-5.3/lib/sh/utf8.c:38:10: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 38 | return strchr (s, c); /* for now */
# | ^~~~~~
# 36| utf8_mbschr (const char *s, int c)
# 37| {
# 38|-> return strchr (s, c); /* for now */
# 39| }
# 40|
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/sh/utf8.c:38:10: warning[-Wdiscarded-qualifiers]: return discards ‘const’ qualifier from pointer target type
# 36| utf8_mbschr (const char *s, int c)
# 37| {
# 38|-> return strchr (s, c); /* for now */
# 39| }
# 40|
Error: GCC_ANALYZER_WARNING (CWE-476):
bash-5.3/lib/sh/zgetline.c:110:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
bash-5.3/lib/sh/zgetline.c:70:6: branch_false: following ‘false’ branch...
bash-5.3/lib/sh/zgetline.c:70:34: branch_false: ...to here
bash-5.3/lib/sh/zgetline.c:70:7: branch_true: following ‘true’ branch...
bash-5.3/lib/sh/zgetline.c:70:51: branch_true: ...to here
bash-5.3/lib/sh/zgetline.c:70:33: branch_false: following ‘false’ branch...
bash-5.3/lib/sh/zgetline.c:70:33: branch_false: ...to here
bash-5.3/lib/sh/zgetline.c:80:10: branch_false: following ‘false’ branch (when ‘retval > 0’)...
bash-5.3/lib/sh/zgetline.c:87:11: branch_false: ...to here
bash-5.3/lib/sh/zgetline.c:87:10: branch_false: following ‘false’ branch...
bash-5.3/lib/sh/zgetline.c:110:11: branch_false: ...to here
bash-5.3/lib/sh/zgetline.c:110:7: danger: dereference of NULL ‘line + (sizetype)nr’
# 108| }
# 109|
# 110|-> line[nr] = c;
# 111| nr++;
# 112|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/lib/tilde/tilde.c:188:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 188 | if (result = strchr (string, '~'))
# | ^~~~~~
# 186|
# 187| result_index = result_size = 0;
# 188|-> if (result = strchr (string, '~'))
# 189| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 190| else
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/tilde/tilde.c: scope_hint: In function ‘tilde_expand’
bash-5.3/lib/tilde/tilde.c:188:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 188 | if (result = strchr (string, '~'))
# | ^
# 186|
# 187| result_index = result_size = 0;
# 188|-> if (result = strchr (string, '~'))
# 189| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 190| else
Error: COMPILER_WARNING (CWE-704):
bash-5.3/lib/tilde/tilde.c:188:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 186|
# 187| result_index = result_size = 0;
# 188|-> if (result = strchr (string, '~'))
# 189| result = (char *)xmalloc (result_size = (strlen (string) + 16));
# 190| else
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/locale.c:416: error[uninitvar]: Uninitialized variable: retval
# 414| u32reset ();
# 415| #endif
# 416|-> return retval;
# 417| }
# 418|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/locale.c: scope_hint: In function ‘locale_isutf8’
bash-5.3/locale.c:620:14: warning[-Wunused-variable]: unused variable ‘encoding’
# 620 | char *cp, *encoding;
# | ^~~~~~~~
# 618| const char *cp;
# 619| #else
# 620|-> char *cp, *encoding;
# 621| #endif
# 622|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/mailcheck.c: scope_hint: In function ‘remember_mail_dates’
bash-5.3/mailcheck.c:392:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 392 | while (mailfile = extract_colon_unit (mailpaths, &i))
# | ^~~~~~~~
# 390| }
# 391|
# 392|-> while (mailfile = extract_colon_unit (mailpaths, &i))
# 393| {
# 394| mp = parse_mailpath_spec (mailfile);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/mailcheck.c: scope_hint: In function ‘check_mail’
bash-5.3/mailcheck.c:464:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 464 | if (temp = expand_string_to_string (message, Q_DOUBLE_QUOTES))
# | ^~~~
# 462| #undef mtime
# 463|
# 464|-> if (temp = expand_string_to_string (message, Q_DOUBLE_QUOTES))
# 465| {
# 466| puts (temp);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/make_cmd.c: scope_hint: In function ‘make_here_document’
bash-5.3/make_cmd.c:571:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 571 | while (full_line = read_secondary_line (delim_unquoted))
# | ^~~~~~~~~
# 569| be read verbatim from the input. If it was not quoted, we
# 570| need to perform backslash-quoted newline removal. */
# 571|-> while (full_line = read_secondary_line (delim_unquoted))
# 572| {
# 573| register char *line;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/parse.y:317:12: warning[-Wunused-variable]: ‘save_simple_lineno’ defined but not used
# 317 | static int save_simple_lineno = -1;
# | ^~~~~~~~~~~~~~~~~~
# 315|
# 316| static int simplecmd_lineno = -1;
# 317|-> static int save_simple_lineno = -1;
# 318|
# 319| /* The line number in a script on which a function definition starts. */
Error: COMPILER_WARNING (CWE-563):
bash-5.3/parse.y:325:12: warning[-Wunused-variable]: ‘save_bstart’ defined but not used
# 325 | static int save_bstart = -1;
# | ^~~~~~~~~~~
# 323| /* The line number in a script on which a function body starts. */
# 324| static int function_bstart;
# 325|-> static int save_bstart = -1;
# 326|
# 327| /* The line number in a script at which an arithmetic for command starts. */
Error: COMPILER_WARNING (CWE-563):
bash-5.3/parse.y:371:14: warning[-Wunused-variable]: ‘yyoutstream’ defined but not used
# 371 | static FILE *yyoutstream;
# | ^~~~~~~~~~~
# 369| static REDIRECTEE redir;
# 370|
# 371|-> static FILE *yyoutstream;
# 372| static FILE *yyerrstream;
# 373| %}
Error: COMPILER_WARNING (CWE-563):
bash-5.3/parse.y:372:14: warning[-Wunused-variable]: ‘yyerrstream’ defined but not used
# 372 | static FILE *yyerrstream;
# | ^~~~~~~~~~~
# 370|
# 371| static FILE *yyoutstream;
# 372|-> static FILE *yyerrstream;
# 373| %}
# 374|
Error: COMPILER_WARNING:
bash-5.3/parse.y: scope_hint: In function ‘parse_matched_pair’
bash-5.3/parse.y:3879:18: warning[-Wunused-but-set-variable=]: variable ‘prevch’ set but not used
# 3879 | int count, ch, prevch, tflags, start_lineno;
# | ^~~~~~
# 3877| parse_matched_pair (int qc, int open, int close, size_t *lenp, int flags)
# 3878| {
# 3879|-> int count, ch, prevch, tflags, start_lineno;
# 3880| size_t nestlen, ttranslen;
# 3881| char *ret, *nestret, *ttrans;
Error: COMPILER_WARNING:
bash-5.3/parse.y: scope_hint: In function ‘parse_comsub’
bash-5.3/parse.y:4455:7: warning[-Wunused-but-set-variable=]: variable ‘start_lineno’ set but not used
# 4455 | int start_lineno, save_lineno;
# | ^~~~~~~~~~~~
# 4453| int peekc, r;
# 4454| int dolbrace_spec, local_extglob, was_extpat;
# 4455|-> int start_lineno, save_lineno;
# 4456| int was_word, was_newline, was_semi, was_amp;
# 4457| char *ret, *tcmd;
Error: COMPILER_WARNING (CWE-457):
bash-5.3/parse.y:4571:19: warning[-Wmaybe-uninitialized]: ‘local_extglob’ may be used uninitialized
# 4571 | extended_glob = local_extglob;
# | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
bash-5.3/parse.y:4454:22: note: ‘local_extglob’ was declared here
# 4454 | int dolbrace_spec, local_extglob, was_extpat;
# | ^~~~~~~~~~~~~
# 4569| #if defined (EXTENDED_GLOB)
# 4570| if (shell_compatibility_level <= 51 && was_extpat == 0)
# 4571|-> extended_glob = local_extglob;
# 4572| #endif
# 4573|
Error: COMPILER_WARNING (CWE-457):
bash-5.3/parse.y: scope_hint: In function ‘parse_comsub’
bash-5.3/parse.y:4659:14: warning[-Wmaybe-uninitialized]: ‘dolbrace_spec’ may be used uninitialized
# 4659 | ret[0] = (dolbrace_spec == '|') ? '|' : ' ';
# | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.3/parse.y:4454:7: note: ‘dolbrace_spec’ was declared here
# 4454 | int dolbrace_spec, local_extglob, was_extpat;
# | ^~~~~~~~~~~~~
# 4657| retlen++;
# 4658| ret = xmalloc (retlen + 4);
# 4659|-> ret[0] = (dolbrace_spec == '|') ? '|' : ' ';
# 4660| strcpy (ret + 1, tcmd); /* ( */
# 4661| if (was_newline)
Error: COMPILER_WARNING:
bash-5.3/parse.y: scope_hint: In function ‘xparse_dolparen’
bash-5.3/parse.y:4690:10: warning[-Wunused-but-set-variable=]: variable ‘orig_ind’ set but not used
# 4690 | size_t orig_ind;
# | ^~~~~~~~
# 4688| sh_parser_state_t ps;
# 4689| sh_input_line_state_t ls;
# 4690|-> size_t orig_ind;
# 4691| int nc, sflags, start_lineno, local_extglob, funsub, closer;
# 4692| int save_lineno;
Error: COMPILER_WARNING:
bash-5.3/parse.y: scope_hint: In function ‘parse_dparen’
bash-5.3/parse.y:4904:15: warning[-Wunused-but-set-variable=]: variable ‘sline’ set but not used
# 4904 | int cmdtyp, sline;
# | ^~~~~
# 4902| parse_dparen (int c)
# 4903| {
# 4904|-> int cmdtyp, sline;
# 4905| char *wval;
# 4906| WORD_DESC *wd;
Error: COMPILER_WARNING:
bash-5.3/parse.y: scope_hint: In function ‘parse_arith_cmd’
bash-5.3/parse.y:4966:7: warning[-Wunused-but-set-variable=]: variable ‘exp_lineno’ set but not used
# 4966 | int exp_lineno, rval, c;
# | ^~~~~~~~~~
# 4964| parse_arith_cmd (char **ep, int adddq)
# 4965| {
# 4966|-> int exp_lineno, rval, c;
# 4967| char *ttok, *tokstr;
# 4968| size_t ttoklen;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y: scope_hint: In function ‘cond_error’
bash-5.3/parse.y:5022:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5022 | if (etext = error_token_from_token (cond_token))
# | ^~~~~
# 5020| else if (cond_token != COND_ERROR)
# 5021| {
# 5022|-> if (etext = error_token_from_token (cond_token))
# 5023| {
# 5024| parser_error (cond_lineno, _("syntax error in conditional expression: unexpected token `%s'"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y: scope_hint: In function ‘cond_term’
bash-5.3/parse.y:5104:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5104 | if (etext = error_token_from_token (cond_token))
# | ^~~~~
# 5102| if (term)
# 5103| dispose_cond_node (term); /* ( */
# 5104|-> if (etext = error_token_from_token (cond_token))
# 5105| {
# 5106| parser_error (lineno, _("unexpected token `%s', expected `)'"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y:5138:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5138 | if (etext = error_token_from_token (tok))
# | ^~~~~
# 5136| {
# 5137| dispose_word (op);
# 5138|-> if (etext = error_token_from_token (tok))
# 5139| {
# 5140| parser_error (line_number, _("unexpected argument `%s' to conditional unary operator"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y:5189:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5189 | if (etext = error_token_from_token (tok))
# | ^~~~~
# 5187| else
# 5188| {
# 5189|-> if (etext = error_token_from_token (tok))
# 5190| {
# 5191| parser_error (line_number, _("unexpected token `%s', conditional binary operator expected"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y:5222:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5222 | if (etext = error_token_from_token (tok))
# | ^~~~~
# 5220| else
# 5221| {
# 5222|-> if (etext = error_token_from_token (tok))
# 5223| {
# 5224| parser_error (line_number, _("unexpected argument `%s' to conditional binary operator"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y:5240:16: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5240 | else if (etext = error_token_from_token (tok))
# | ^~~~~
# 5238| if (tok < 256)
# 5239| parser_error (line_number, _("unexpected token `%c' in conditional command"), tok);
# 5240|-> else if (etext = error_token_from_token (tok))
# 5241| {
# 5242| parser_error (line_number, _("unexpected token `%s' in conditional command"), etext);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y: scope_hint: In function ‘decode_prompt_string’
bash-5.3/parse.y:6293:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6293 | while (c = *string++)
# | ^
# 6291| decoding_prompt = string;
# 6292|
# 6293|-> while (c = *string++)
# 6294| {
# 6295| if (posixly_correct && c == '!')
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y: scope_hint: In function ‘error_token_from_token’
bash-5.3/parse.y:6738:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6738 | if (t = find_token_in_alist (tok, word_token_alist, 0))
# | ^
# 6736| char *t;
# 6737|
# 6738|-> if (t = find_token_in_alist (tok, word_token_alist, 0))
# 6739| return t;
# 6740|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y:6741:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6741 | if (t = find_token_in_alist (tok, other_token_alist, 0))
# | ^
# 6739| return t;
# 6740|
# 6741|-> if (t = find_token_in_alist (tok, other_token_alist, 0))
# 6742| return t;
# 6743|
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/parse.y: scope_hint: At top level
bash-5.3/parse.y:6927:1: warning[-Wunused-function]: ‘discard_parser_constructs’ defined but not used
# 6927 | discard_parser_constructs (int error_p)
# | ^~~~~~~~~~~~~~~~~~~~~~~~~
# 6925| (dispose_command () will actually free the command.) */
# 6926| static void
# 6927|-> discard_parser_constructs (int error_p)
# 6928| {
# 6929| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/parse.y: scope_hint: In function ‘parse_string_to_word_list’
bash-5.3/parse.y:7032:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 7032 | if (ea = expanding_alias ())
# | ^~
# 7030|
# 7031| push_stream (1);
# 7032|-> if (ea = expanding_alias ())
# 7033| parser_save_alias ();
# 7034|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/pathexp.c: scope_hint: In function ‘unquoted_glob_pattern_p’
bash-5.3/pathexp.c:77:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 77 | while (c = *string++)
# | ^
# 75| send = string + strlen (string);
# 76|
# 77|-> while (c = *string++)
# 78| {
# 79| switch (c)
Error: COMPILER_WARNING (CWE-563):
bash-5.3/pathexp.c: scope_hint: In function ‘shell_glob_filename’
bash-5.3/pathexp.c:445:15: warning[-Wunused-variable]: unused variable ‘quoted_pattern’
# 445 | int gflags, quoted_pattern;
# | ^~~~~~~~~~~~~~
# 443| {
# 444| char *temp, **results;
# 445|-> int gflags, quoted_pattern;
# 446|
# 447| noglob_dot_filenames = glob_dot_filenames == 0;
Error: COMPILER_WARNING (CWE-704):
bash-5.3/pathexp.c: scope_hint: In function ‘glob_name_is_acceptable’
bash-5.3/pathexp.c:536:5: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 536 | n = strrchr (name, '/');
# | ^
# 534| /* . and .. are never matched. We extend this to the terminal component of a
# 535| pathname. */
# 536|-> n = strrchr (name, '/');
# 537| if (n == 0 || n[1] == 0)
# 538| n = (char *)name;
Error: COMPILER_WARNING (CWE-704):
bash-5.3/pathexp.c:536:5: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 534| /* . and .. are never matched. We extend this to the terminal component of a
# 535| pathname. */
# 536|-> n = strrchr (name, '/');
# 537| if (n == 0 || n[1] == 0)
# 538| n = (char *)name;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/pathexp.c: scope_hint: In function ‘setup_ignore_patterns’
bash-5.3/pathexp.c:664:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 664 | while (colon_bit = split_ignorespec (this_ignoreval, &ptr))
# | ^~~~~~~~~
# 662| numitems = maxitems = ptr = 0;
# 663|
# 664|-> while (colon_bit = split_ignorespec (this_ignoreval, &ptr))
# 665| {
# 666| if (numitems + 1 >= maxitems)
Error: COMPILER_WARNING (CWE-563):
bash-5.3/pathexp.c: scope_hint: In function ‘gs_checknum’
bash-5.3/pathexp.c:820:12: warning[-Wunused-variable]: unused variable ‘i’
# 820 | intmax_t i;
# | ^
# 818| {
# 819| int v;
# 820|-> intmax_t i;
# 821|
# 822| v = all_digits (string);
Error: COMPILER_WARNING (CWE-563):
bash-5.3/pathexp.c: scope_hint: In function ‘globsort_numericcmp’
bash-5.3/pathexp.c:832:15: warning[-Wunused-variable]: unused variable ‘x’
# 832 | int v1, v2, x;
# | ^
# 830| {
# 831| intmax_t i1, i2;
# 832|-> int v1, v2, x;
# 833|
# 834| /* like valid_number but doesn't allow leading/trailing whitespace or sign */
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/pathexp.c:913:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘sortfunc’
bash-5.3/pathexp.c:892:3: branch_false: following ‘false’ branch...
bash-5.3/pathexp.c:908:5: branch_false: ...to here
bash-5.3/pathexp.c:913:3: danger: use of uninitialized value ‘sortfunc’ here
# 911| }
# 912|
# 913|-> qsort (garray, len, sizeof (struct globsort_t), sortfunc);
# 914| }
# 915|
Error: COMPILER_WARNING (CWE-457):
bash-5.3/pathexp.c:913:3: warning[-Wmaybe-uninitialized]: ‘sortfunc’ may be used uninitialized
# 913 | qsort (garray, len, sizeof (struct globsort_t), sortfunc);
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bash-5.3/pathexp.c: scope_hint: In function ‘sh_sortglob’
bash-5.3/pathexp.c:888:11: note: ‘sortfunc’ was declared here
# 888 | QSFUNC *sortfunc;
# | ^~~~~~~~
# 911| }
# 912|
# 913|-> qsort (garray, len, sizeof (struct globsort_t), sortfunc);
# 914| }
# 915|
Error: COMPILER_WARNING:
bash-5.3/print_cmd.c: scope_hint: In function ‘make_command_string_internal’
bash-5.3/print_cmd.c:181:14: warning[-Wformat-zero-length]: zero-length gnu_printf format string
# 181 | cprintf ("");
# | ^~
# 179|
# 180| if (command == 0)
# 181|-> cprintf ("");
# 182| else
# 183| {
Error: COMPILER_WARNING:
bash-5.3/print_cmd.c: scope_hint: In function ‘print_simple_command’
bash-5.3/print_cmd.c:1007:14: warning[-Wformat-zero-length]: zero-length gnu_printf format string
# 1007 | cprintf ("");
# | ^~
# 1005| command_print_word_list (simple_command->words, " ");
# 1006| else
# 1007|-> cprintf ("");
# 1008|
# 1009| if (simple_command->redirects)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/print_cmd.c: scope_hint: At top level
bash-5.3/print_cmd.c:1018:1: warning[-Wunused-function]: ‘print_heredocs’ defined but not used
# 1018 | print_heredocs (REDIRECT *heredocs)
# | ^~~~~~~~~~~~~~
# 1016|
# 1017| static void
# 1018|-> print_heredocs (REDIRECT *heredocs)
# 1019| {
# 1020| REDIRECT *hdtail;
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.3/redir.c:354:7: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘here_document_to_fd(redirectee, ri)’
bash-5.3/redir.c:767:1: enter_function: entry to ‘do_redirection_internal’
bash-5.3/redir.c:1047:10: branch_true: following ‘true’ branch (when ‘redirectee’ is non-NULL)...
bash-5.3/redir.c:1049:16: branch_true: ...to here
bash-5.3/redir.c:1049:16: call_function: calling ‘here_document_to_fd’ from ‘do_redirection_internal’
bash-5.3/redir.c:1049:16: return_function: returning to ‘do_redirection_internal’ from ‘here_document_to_fd’
bash-5.3/redir.c:1051:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1057:15: branch_false: ...to here
bash-5.3/redir.c:1057:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1066:15: branch_false: ...to here
bash-5.3/redir.c:1066:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1110:14: branch_false: ...to here
bash-5.3/redir.c:354:7: danger: ‘here_document_to_fd(redirectee, ri)’ leaks here; was opened at [(15)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/14)
# 352| int old;
# 353|
# 354|-> if (redirectee->word == 0 || redirectee->word[0] == '\0')
# 355| {
# 356| if (lenp)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/redir.c:748:1: warning[-Wunused-function]: ‘undoablefd’ defined but not used
# 748 | undoablefd (int fd)
# | ^~~~~~~~~~
# 746|
# 747| static int
# 748|-> undoablefd (int fd)
# 749| {
# 750| int clexec;
Error: COMPILER_WARNING:
bash-5.3/redir.c: scope_hint: In function ‘do_redirection_internal’
bash-5.3/redir.c:770:52: warning[-Wunused-but-set-variable=]: variable ‘fdactive’ set but not used
# 770 | int redir_fd, fd, redirector, r, oflags, rflags, fdactive;
# | ^~~~~~~~
# 768| {
# 769| WORD_DESC *redirectee;
# 770|-> int redir_fd, fd, redirector, r, oflags, rflags, fdactive;
# 771| intmax_t lfd;
# 772| char *redirectee_word;
Error: GCC_ANALYZER_WARNING (CWE-457):
bash-5.3/redir.c:913:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘oflags’
bash-5.3/redir.c:908:10: branch_false: following ‘false’ branch...
bash-5.3/redir.c:911:27: branch_false: ...to here
bash-5.3/redir.c:912:10: branch_true: following ‘true’ branch...
bash-5.3/redir.c:913:9: danger: use of uninitialized value ‘oflags’ here
# 911| redirectee_word = savestring (redirectee->word);
# 912| if (posixly_correct && interactive_shell == 0)
# 913|-> redirectee->flags = oflags;
# 914|
# 915| if (redirectee_word == 0)
Error: COMPILER_WARNING (CWE-457):
bash-5.3/redir.c: scope_hint: In function ‘do_redirection_internal.constprop.0’
bash-5.3/redir.c:913:27: warning[-Wmaybe-uninitialized]: ‘oflags’ may be used uninitialized
# 913 | redirectee->flags = oflags;
# | ~~~~~~~~~~~~~~~~~~^~~~~~~~
bash-5.3/redir.c:770:36: note: ‘oflags’ was declared here
# 770 | int redir_fd, fd, redirector, r, oflags, rflags, fdactive;
# | ^~~~~~
# 911| redirectee_word = savestring (redirectee->word);
# 912| if (posixly_correct && interactive_shell == 0)
# 913|-> redirectee->flags = oflags;
# 914|
# 915| if (redirectee_word == 0)
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.3/redir.c:994:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(redir_open(redirectee_word, *redirect.flags, 438, ri), redirector)’
bash-5.3/redir.c:767:1: enter_function: entry to ‘do_redirection_internal’
bash-5.3/redir.c:908:10: branch_true: following ‘true’ branch...
bash-5.3/redir.c:909:27: branch_true: ...to here
bash-5.3/redir.c:909:27: call_function: calling ‘redirection_expand’ from ‘do_redirection_internal’
bash-5.3/redir.c:909:27: return_function: returning to ‘do_redirection_internal’ from ‘redirection_expand’
bash-5.3/redir.c:915:10: branch_false: following ‘false’ branch (when ‘redirectee_word’ is non-NULL)...
bash-5.3/redir.c:919:11: branch_false: ...to here
bash-5.3/redir.c:926:12: call_function: calling ‘redir_open’ from ‘do_redirection_internal’
bash-5.3/redir.c:926:12: return_function: returning to ‘do_redirection_internal’ from ‘redir_open’
bash-5.3/redir.c:927:10: branch_false: following ‘false’ branch (when ‘fnp’ is NULL)...
bash-5.3/redir.c:930:9: branch_false: ...to here
bash-5.3/redir.c:932:10: branch_false: following ‘false’ branch...
bash-5.3/redir.c:935:10: branch_false: ...to here
bash-5.3/redir.c:935:10: branch_false: following ‘false’ branch...
bash-5.3/redir.c:938:11: branch_false: ...to here
bash-5.3/redir.c:938:10: branch_true: following ‘true’ branch...
bash-5.3/redir.c:940:15: branch_true: ...to here
bash-5.3/redir.c:940:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:949:15: branch_false: ...to here
bash-5.3/redir.c:949:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:968:14: branch_false: ...to here
bash-5.3/redir.c:968:15: branch_false: following ‘false’ branch...
bash-5.3/redir.c:974:14: branch_false: ...to here
bash-5.3/redir.c:985:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:994:19: branch_false: ...to here
bash-5.3/redir.c:994:19: branch_true: following ‘true’ branch...
bash-5.3/redir.c:994:43: branch_true: ...to here
bash-5.3/redir.c:994:43: acquire_resource: opened here
bash-5.3/redir.c:994:20: danger: ‘dup2(redir_open(redirectee_word, *redirect.flags, 438, ri), redirector)’ leaks here; was opened at [(41)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/40)
# 992| }
# 993| }
# 994|-> else if ((fd != redirector) && (dup2 (fd, redirector) < 0))
# 995| {
# 996| close (fd); /* dup2 failed? must be fd limit issue */
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.3/redir.c:1036:18: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(1, 2)’
bash-5.3/redir.c:767:1: enter_function: entry to ‘do_redirection_internal’
bash-5.3/redir.c:908:10: branch_true: following ‘true’ branch...
bash-5.3/redir.c:909:27: branch_true: ...to here
bash-5.3/redir.c:909:27: call_function: calling ‘redirection_expand’ from ‘do_redirection_internal’
bash-5.3/redir.c:909:27: return_function: returning to ‘do_redirection_internal’ from ‘redirection_expand’
bash-5.3/redir.c:915:10: branch_false: following ‘false’ branch (when ‘redirectee_word’ is non-NULL)...
bash-5.3/redir.c:919:11: branch_false: ...to here
bash-5.3/redir.c:927:10: branch_false: following ‘false’ branch (when ‘fnp’ is NULL)...
bash-5.3/redir.c:930:9: branch_false: ...to here
bash-5.3/redir.c:932:10: branch_false: following ‘false’ branch...
bash-5.3/redir.c:935:10: branch_false: ...to here
bash-5.3/redir.c:935:10: branch_false: following ‘false’ branch...
bash-5.3/redir.c:938:11: branch_false: ...to here
bash-5.3/redir.c:938:10: branch_true: following ‘true’ branch...
bash-5.3/redir.c:940:15: branch_true: ...to here
bash-5.3/redir.c:940:14: branch_true: following ‘true’ branch...
bash-5.3/redir.c:942:28: branch_true: ...to here
bash-5.3/redir.c:944:18: branch_false: following ‘false’ branch...
bash-5.3/redir.c:949:15: branch_false: ...to here
bash-5.3/redir.c:968:15: branch_false: following ‘false’ branch...
bash-5.3/redir.c:974:14: branch_false: ...to here
bash-5.3/redir.c:985:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:994:19: branch_false: ...to here
bash-5.3/redir.c:1003:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1016:15: branch_false: ...to here
bash-5.3/redir.c:1030:10: branch_true: following ‘true’ branch...
bash-5.3/redir.c:1032:14: branch_true: ...to here
bash-5.3/redir.c:1032:14: branch_true: following ‘true’ branch...
bash-5.3/redir.c:1034:19: branch_true: ...to here
bash-5.3/redir.c:1034:18: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1036:19: branch_false: ...to here
bash-5.3/redir.c:1036:19: acquire_resource: opened here
bash-5.3/redir.c:1036:18: danger: ‘dup2(1, 2)’ leaks here; was opened at [(37)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/36)
# 1034| if (flags & RX_UNDOABLE)
# 1035| add_undo_redirect (2, ri, -1);
# 1036|-> if (dup2 (1, 2) < 0)
# 1037| return (errno);
# 1038| }
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.3/redir.c:1097:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(here_document_to_fd(redirectee, ri), redirector)’
bash-5.3/redir.c:767:1: enter_function: entry to ‘do_redirection_internal’
bash-5.3/redir.c:1047:10: branch_true: following ‘true’ branch (when ‘redirectee’ is non-NULL)...
bash-5.3/redir.c:1049:16: branch_true: ...to here
bash-5.3/redir.c:1049:16: call_function: calling ‘here_document_to_fd’ from ‘do_redirection_internal’
bash-5.3/redir.c:1049:16: return_function: returning to ‘do_redirection_internal’ from ‘here_document_to_fd’
bash-5.3/redir.c:1051:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1057:15: branch_false: ...to here
bash-5.3/redir.c:1057:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1066:15: branch_false: ...to here
bash-5.3/redir.c:1066:14: branch_true: following ‘true’ branch...
bash-5.3/redir.c:1068:19: branch_true: ...to here
bash-5.3/redir.c:1068:18: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1088:19: branch_false: ...to here
bash-5.3/redir.c:1088:18: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1097:23: branch_false: ...to here
bash-5.3/redir.c:1097:23: branch_true: following ‘true’ branch...
bash-5.3/redir.c:1097:44: branch_true: ...to here
bash-5.3/redir.c:1097:44: acquire_resource: opened here
bash-5.3/redir.c:1097:24: danger: ‘dup2(here_document_to_fd(redirectee, ri), redirector)’ leaks here; was opened at [(28)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/27)
# 1095| }
# 1096| }
# 1097|-> else if (fd != redirector && dup2 (fd, redirector) < 0)
# 1098| {
# 1099| r = errno;
Error: GCC_ANALYZER_WARNING (CWE-775):
bash-5.3/redir.c:1170:19: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(redir_fd, redirector)’
bash-5.3/redir.c:1119:10: branch_true: following ‘true’ branch...
bash-5.3/redir.c:1119:35: branch_true: ...to here
bash-5.3/redir.c:1128:11: branch_true: following ‘true’ branch (when ‘redir_fd != redirector’)...
bash-5.3/redir.c:1130:15: branch_true: ...to here
bash-5.3/redir.c:1158:15: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1161:15: branch_false: ...to here
bash-5.3/redir.c:1161:14: branch_false: following ‘false’ branch...
bash-5.3/redir.c:1170:20: branch_false: ...to here
bash-5.3/redir.c:1170:20: acquire_resource: opened here
bash-5.3/redir.c:1170:19: danger: ‘dup2(redir_fd, redirector)’ leaks here; was opened at [(11)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/10)
# 1168| }
# 1169| /* This is correct. 2>&1 means dup2 (1, 2); */
# 1170|-> else if (dup2 (redir_fd, redirector) < 0)
# 1171| return (errno);
# 1172|
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/redir.c: scope_hint: At top level
bash-5.3/redir.c:1376:1: warning[-Wunused-function]: ‘add_undo_fd_redirect’ defined but not used
# 1376 | add_undo_fd_redirect (int sfd, int rfd)
# | ^~~~~~~~~~~~~~~~~~~~
# 1374|
# 1375| static int
# 1376|-> add_undo_fd_redirect (int sfd, int rfd)
# 1377| {
# 1378| REDIRECTEE rd, sd;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/redir.c: scope_hint: In function ‘redir_varvalue’
bash-5.3/redir.c:1477:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1477 | if (vr = valid_array_reference (w, 0))
# | ^~
# 1475| /* XXX - handle set -u here? */
# 1476| #if defined (ARRAY_VARS)
# 1477|-> if (vr = valid_array_reference (w, 0))
# 1478| {
# 1479| v = array_variable_part (w, 0, &sub, &len);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/redir.c:1492:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1492 | if (vr = valid_array_reference (w, 0))
# | ^~
# 1490| {
# 1491| w = nameref_cell (v);
# 1492|-> if (vr = valid_array_reference (w, 0))
# 1493| v = array_variable_part (w, 0, &sub, &len);
# 1494| else
Error: COMPILER_WARNING (CWE-569):
bash-5.3/shell.c: scope_hint: In function ‘parse_shell_options’
bash-5.3/shell.c:925:14: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 925 | while (arg_character = arg_string[i++])
# | ^~~~~~~~~~~~~
# 923| i = 1;
# 924| on_or_off = arg_string[0];
# 925|-> while (arg_character = arg_string[i++])
# 926| {
# 927| switch (arg_character)
Error: COMPILER_WARNING:
bash-5.3/shell.c: scope_hint: In function ‘disable_priv_mode’
bash-5.3/shell.c:1351:7: warning[-Wunused-but-set-variable=]: variable ‘e’ set but not used
# 1351 | int e, r;
# | ^
# 1349| disable_priv_mode (void)
# 1350| {
# 1351|-> int e, r;
# 1352|
# 1353| r = 0;
Error: CPPCHECK_WARNING (CWE-476):
bash-5.3/sig.c:688: error[nullPointer]: Null pointer dereference: (volatile unsigned long*)0
# 686|
# 687| if (core)
# 688|-> *((volatile unsigned long *) NULL) = 0xdead0000 + sig; /* SIGSEGV */
# 689|
# 690| exit (128+sig);
Error: COMPILER_WARNING (CWE-563):
bash-5.3/stringlib.c: scope_hint: In function ‘strsub’
bash-5.3/stringlib.c:140:16: warning[-Wunused-variable]: unused variable ‘r’
# 140 | char *temp, *r;;
# | ^
# 138| size_t patlen, replen, templen, tempsize, i;
# 139| int repl;
# 140|-> char *temp, *r;;
# 141|
# 142| patlen = strlen (pat);
Error: GCC_ANALYZER_WARNING (CWE-688):
bash-5.3/stringlib.c:155:11: warning[-Wanalyzer-null-argument]: use of NULL ‘temp’ where non-null expected
bash-5.3/stringlib.c:144:59: branch_true: following ‘true’ branch...
bash-5.3/stringlib.c:146:10: branch_true: ...to here
bash-5.3/stringlib.c:146:10: branch_true: following ‘true’ branch...
bash-5.3/stringlib.c:148:14: branch_false: following ‘false’ branch (when ‘replen == 0’)...
bash-5.3/stringlib.c:155:19: branch_false: ...to here
bash-5.3/stringlib.c:155:19: release_memory: ‘temp’ is NULL
bash-5.3/stringlib.c:155:11: danger: argument 1 (‘temp + templen’) NULL where non-null expected
# 153| temp[templen++] = *r++;
# 154| #else
# 155|-> memcpy (temp + templen, rep, replen);
# 156| templen += replen;
# 157| #endif
Error: COMPILER_WARNING (CWE-563):
bash-5.3/subst.c:229:53: warning[-Wunused-variable]: ‘expand_param_unset’ defined but not used
# 229 | static char expand_param_error, expand_param_fatal, expand_param_unset;
# | ^~~~~~~~~~~~~~~~~~
# 227| static WORD_LIST expand_word_error, expand_word_fatal;
# 228| static WORD_DESC expand_wdesc_error, expand_wdesc_fatal;
# 229|-> static char expand_param_error, expand_param_fatal, expand_param_unset;
# 230| static char extract_string_error, extract_string_fatal;
# 231|
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c: scope_hint: At top level
bash-5.3/subst.c:243:14: warning[-Wunused-function]: ‘quoted_substring’ declared ‘static’ but never defined
# 243 | static char *quoted_substring (char *, int, int);
# | ^~~~~~~~~~~~~~~~
# 241| static WORD_LIST *garglist = (WORD_LIST *)NULL;
# 242|
# 243|-> static char *quoted_substring (char *, int, int);
# 244| static int quoted_strlen (char *);
# 245| static char *quoted_strchr (char *, int, int);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:244:12: warning[-Wunused-function]: ‘quoted_strlen’ declared ‘static’ but never defined
# 244 | static int quoted_strlen (char *);
# | ^~~~~~~~~~~~~
# 242|
# 243| static char *quoted_substring (char *, int, int);
# 244|-> static int quoted_strlen (char *);
# 245| static char *quoted_strchr (char *, int, int);
# 246|
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:245:14: warning[-Wunused-function]: ‘quoted_strchr’ declared ‘static’ but never defined
# 245 | static char *quoted_strchr (char *, int, int);
# | ^~~~~~~~~~~~~
# 243| static char *quoted_substring (char *, int, int);
# 244| static int quoted_strlen (char *);
# 245|-> static char *quoted_strchr (char *, int, int);
# 246|
# 247| static char *expand_string_if_necessary (char *, int, EXPFUNC *);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:261:19: warning[-Wunused-function]: ‘list_dequote_escapes’ declared ‘static’ but never defined
# 261 | static WORD_LIST *list_dequote_escapes (WORD_LIST *);
# | ^~~~~~~~~~~~~~~~~~~~
# 259|
# 260| static WORD_LIST *list_quote_escapes (WORD_LIST *);
# 261|-> static WORD_LIST *list_dequote_escapes (WORD_LIST *);
# 262|
# 263| static char *make_quoted_char (int);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:266:12: warning[-Wunused-function]: ‘unquoted_substring’ declared ‘static’ but never defined
# 266 | static int unquoted_substring (const char *, const char *);
# | ^~~~~~~~~~~~~~~~~~
# 264| static WORD_LIST *quote_list (WORD_LIST *);
# 265|
# 266|-> static int unquoted_substring (const char *, const char *);
# 267| static int unquoted_member (int, const char *);
# 268|
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:267:12: warning[-Wunused-function]: ‘unquoted_member’ declared ‘static’ but never defined
# 267 | static int unquoted_member (int, const char *);
# | ^~~~~~~~~~~~~~~
# 265|
# 266| static int unquoted_substring (const char *, const char *);
# 267|-> static int unquoted_member (int, const char *);
# 268|
# 269| #if defined (ARRAY_VARS)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:286:23: warning[-Wunused-function]: ‘mb_getcharlens’ declared ‘static’ but never defined
# 286 | static unsigned char *mb_getcharlens (const char *, int);
# | ^~~~~~~~~~~~~~
# 284| static char *pos_params (const char *, int, int, int, int);
# 285|
# 286|-> static unsigned char *mb_getcharlens (const char *, int);
# 287|
# 288| static char *remove_upattern (char *, char *, int);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:301:14: warning[-Wunused-function]: ‘variable_remove_pattern’ declared ‘static’ but never defined
# 301 | static char *variable_remove_pattern (char *, char *, int, int);
# | ^~~~~~~~~~~~~~~~~~~~~~~
# 299| static int getpatspec (int, const char *);
# 300| static char *getpattern (char *, int, int);
# 301|-> static char *variable_remove_pattern (char *, char *, int, int);
# 302| static char *list_remove_pattern (WORD_LIST *, char *, int, int, int);
# 303| static char *parameter_list_remove_pattern (int, char *, int, int);
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:348:14: warning[-Wunused-function]: ‘mb_subfstring’ declared ‘static’ but never defined
# 348 | static char *mb_subfstring (const char *, int, int);
# | ^~~~~~~~~~~~~
# 346| static int verify_substring_values (SHELL_VAR *, char *, char *, int, intmax_t *, intmax_t *);
# 347| static int get_var_and_type (char *, char *, array_eltstate_t *, int, int, SHELL_VAR **, char **);
# 348|-> static char *mb_subfstring (const char *, int, int);
# 349| static char *parameter_brace_substring (char *, char *, array_eltstate_t *, char *, int, int, int);
# 350|
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:358:14: warning[-Wunused-function]: ‘pos_params_casemod’ declared ‘static’ but never defined
# 358 | static char *pos_params_casemod (char *, char *, int, int);
# | ^~~~~~~~~~~~~~~~~~
# 356| static char *parameter_brace_patsub (char *, char *, array_eltstate_t *, char *, int, int, int);
# 357|
# 358|-> static char *pos_params_casemod (char *, char *, int, int);
# 359| static char *parameter_brace_casemod (char *, char *, array_eltstate_t *, int, char *, int, int, int);
# 360|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘string_extract’
bash-5.3/subst.c:802:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 802 | while (c = string[i])
# | ^
# 800| i = *sindex;
# 801| found = 0;
# 802|-> while (c = string[i])
# 803| {
# 804| if (c == '\\')
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘string_extract_double_quoted’
bash-5.3/subst.c:873:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 873 | while (c = string[i])
# | ^
# 871| j = 0;
# 872| i = *sindex;
# 873|-> while (c = string[i])
# 874| {
# 875| /* Process a character that was quoted by a backslash. */
Error: COMPILER_WARNING:
bash-5.3/subst.c:1018:9: warning[-Wunused-but-set-variable=]: variable ‘ret’ set but not used
# 1018 | char *ret;
# | ^~~
# 1016| int c;
# 1017| size_t i, si;
# 1018|-> char *ret;
# 1019| int pass_next, backquote;
# 1020| DECLARE_MBSTATE;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘skip_double_quoted’
bash-5.3/subst.c:1024:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1024 | while (c = string[i])
# | ^
# 1022| pass_next = backquote = 0;
# 1023| i = sind;
# 1024|-> while (c = string[i])
# 1025| {
# 1026| if (pass_next)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘string_extract_verbatim’
bash-5.3/subst.c:1182:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1182 | while (c = string[i])
# | ^
# 1180| wcharlist = 0;
# 1181| #endif
# 1182|-> while (c = string[i])
# 1183| {
# 1184| #if defined (HANDLE_MULTIBYTE)
Error: COMPILER_WARNING (CWE-563):
bash-5.3/subst.c:1363:10: warning[-Wunused-variable]: unused variable ‘xflags’
# 1363 | int c, xflags;
# | ^~~~~~
# 1361| extract_delimited_string (const char *string, size_t *sindex, char *opener, char *alt_opener, char *closer, int flags)
# 1362| {
# 1363|-> int c, xflags;
# 1364| size_t i, si, slen;
# 1365| char *t, *result;
Error: COMPILER_WARNING:
bash-5.3/subst.c: scope_hint: In function ‘extract_delimited_string’
bash-5.3/subst.c:1365:9: warning[-Wunused-but-set-variable=]: variable ‘t’ set but not used
# 1365 | char *t, *result;
# | ^
# 1363| int c, xflags;
# 1364| size_t i, si, slen;
# 1365|-> char *t, *result;
# 1366| int pass_character, nesting_level, in_comment;
# 1367| size_t len_closer, len_opener, len_alt_opener;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘extract_heredoc_dolbrace_string’
bash-5.3/subst.c:1560:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1560 | while (c = string[i])
# | ^
# 1558|
# 1559| i = *sindex;
# 1560|-> while (c = string[i])
# 1561| {
# 1562| if (pass_character)
Error: COMPILER_WARNING:
bash-5.3/subst.c: scope_hint: In function ‘extract_dollar_brace_string’
bash-5.3/subst.c:1644:11: warning[-Wstringop-truncation]: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length
# 1644 | strncpy (result + result_index, t, tlen);
# | ^
bash-5.3/subst.c:1640:18: note: length computed here
# 1640 | tlen = strlen (t);
# | ^~~~~~~~~~
# 1642|
# 1643| RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 1, result_size, 64);
# 1644|-> strncpy (result + result_index, t, tlen);
# 1645| result_index += tlen;
# 1646| free (t);
Error: COMPILER_WARNING:
bash-5.3/subst.c:1830:18: warning[-Wunused-but-set-variable=]: variable ‘t’ set but not used
# 1830 | char *result, *t;
# | ^
# 1828| size_t si, slen;
# 1829| int pass_character, nesting_level, dolbrace_state;
# 1830|-> char *result, *t;
# 1831| DECLARE_MBSTATE;
# 1832|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘extract_dollar_brace_string’
bash-5.3/subst.c:1851:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1851 | while (c = string[i])
# | ^
# 1849|
# 1850| i = *sindex;
# 1851|-> while (c = string[i])
# 1852| {
# 1853| if (pass_character)
Error: COMPILER_WARNING:
bash-5.3/subst.c:2090:9: warning[-Wunused-but-set-variable=]: variable ‘temp’ set but not used
# 2090 | char *temp;
# | ^~~~
# 2088| int pass_next, backq, c, count, oldjmp;
# 2089| size_t i, si, slen;
# 2090|-> char *temp;
# 2091| DECLARE_MBSTATE;
# 2092|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘skip_matched_pair’
bash-5.3/subst.c:2103:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2103 | while (c = string[i])
# | ^
# 2101| count = 1;
# 2102| pass_next = backq = 0;
# 2103|-> while (c = string[i])
# 2104| {
# 2105| if (pass_next)
Error: COMPILER_WARNING:
bash-5.3/subst.c:2205:9: warning[-Wunused-but-set-variable=]: variable ‘temp’ set but not used
# 2205 | char *temp, open[3];
# | ^~~~
# 2203| int arithexp, skipcol;
# 2204| size_t i, si, slen;
# 2205|-> char *temp, open[3];
# 2206| DECLARE_MBSTATE;
# 2207|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘skip_to_delim’
bash-5.3/subst.c:2222:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2222 | while (c = string[i])
# | ^
# 2220| i = start;
# 2221| pass_next = backq = dquote = 0;
# 2222|-> while (c = string[i])
# 2223| {
# 2224| /* If this is non-zero, we should not let quote characters be delimiters
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘skip_to_histexp’
bash-5.3/subst.c:2393:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 2393 | while (c = string[i])
# | ^
# 2391| i = start;
# 2392| pass_next = backq = dquote = 0;
# 2393|-> while (c = string[i])
# 2394| {
# 2395| if (pass_next)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘do_assignment_internal’
bash-5.3/subst.c:3599:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3599 | if (t = mbschr (name, LBRACK))
# | ^
# 3597| #if defined (ARRAY_VARS)
# 3598| /* could use strchr, since variable names can't yet contain multibyte characters */
# 3599|-> if (t = mbschr (name, LBRACK))
# 3600| {
# 3601| if (assign_list)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘expand_string_dollar_quote’
bash-5.3/subst.c:4151:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4151 | while (c = string[sindex])
# | ^
# 4149| retind = 0;
# 4150|
# 4151|-> while (c = string[sindex])
# 4152| {
# 4153| switch (c)
Error: CPPCHECK_WARNING (CWE-562):
bash-5.3/subst.c:4709: error[returnDanglingLifetime]: Returning pointer to local variable 'result' that will be invalid when returning.
# 4707|
# 4708| if (strchr (string, CTLESC) == 0)
# 4709|-> return (strcpy (result, string));
# 4710|
# 4711| quote_spaces = (ifs_value && *ifs_value == 0);
Error: CPPCHECK_WARNING (CWE-562):
bash-5.3/subst.c:4831: error[returnDanglingLifetime]: Returning pointer to local variable 'result' that will be invalid when returning.
# 4829| each character. Just return a copy of the string passed to us. */
# 4830| if (strchr (string, CTLESC) == NULL)
# 4831|-> return (strcpy (result, string));
# 4832|
# 4833| send = string + slen;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:4942:1: warning[-Wunused-function]: ‘list_quote_ifs’ defined but not used
# 4942 | list_quote_ifs (WORD_LIST *list)
# | ^~~~~~~~~~~~~~
# 4940|
# 4941| static WORD_LIST *
# 4942|-> list_quote_ifs (WORD_LIST *list)
# 4943| {
# 4944| WORD_LIST *w;
Error: COMPILER_WARNING (CWE-457):
bash-5.3/subst.c: scope_hint: In function ‘read_comsub’
bash-5.3/subst.c:6718:11: warning[-Wmaybe-uninitialized]: ‘bufp’ may be used uninitialized
# 6718 | c = *bufp++;
# | ^~~~~~~
bash-5.3/subst.c:6684:40: note: ‘bufp’ was declared here
# 6684 | char *istring, buf[COMSUB_PIPEBUF], *bufp;
# | ^~~~
# 6716| bufp = buf;
# 6717| }
# 6718|-> c = *bufp++;
# 6719|
# 6720| if (c == 0)
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c:6859:1: warning[-Wunused-function]: ‘uw_unbind_variable’ defined but not used
# 6859 | uw_unbind_variable (void *name)
# | ^~~~~~~~~~~~~~~~~~
# 6857|
# 6858| static void
# 6859|-> uw_unbind_variable (void *name)
# 6860| {
# 6861| unbind_variable_noref (name);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘comsub_quote_string’
bash-5.3/subst.c:6910:24: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6910 | for (i = 0, ind = 0; c = string[i]; )
# | ^
# 6908| skip_ctlnul = ifs_cmap[CTLNUL];
# 6909|
# 6910|-> for (i = 0, ind = 0; c = string[i]; )
# 6911| {
# 6912| if (comsub_shouldquote (c, quoted, flags, skip_ctlesc, skip_ctlnul))
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘function_substitute’
bash-5.3/subst.c:6944:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6944 | if (valsub = (string && *string == '|'))
# | ^~~~~~
# 6942| #endif
# 6943|
# 6944|-> if (valsub = (string && *string == '|'))
# 6945| string++;
# 6946|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘parameter_brace_expand_word’
bash-5.3/subst.c:7774:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 7774 | else if (var = find_variable (name))
# | ^~~
# 7772| }
# 7773| #endif
# 7774|-> else if (var = find_variable (name))
# 7775| {
# 7776| if (var_isset (var) && invisible_p (var) == 0)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c:7804:12: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 7804 | else if (var = find_variable_last_nameref (name, 0))
# | ^~~
# 7802| temp = (char *)NULL;
# 7803| }
# 7804|-> else if (var = find_variable_last_nameref (name, 0))
# 7805| {
# 7806| temp = nameref_cell (var);
Error: COMPILER_WARNING (CWE-457):
bash-5.3/subst.c: scope_hint: In function ‘parameter_brace_find_indir’
bash-5.3/subst.c:7863:33: warning[-Wmaybe-uninitialized]: ‘oldex’ may be used uninitialized
# 7863 | expand_no_split_dollar_star = oldex;
# | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
bash-5.3/subst.c:7844:15: note: ‘oldex’ was declared here
# 7844 | int pflags, oldex;
# | ^~~~~
# 7861| w = parameter_brace_expand_word (name, var_is_special, quoted, pflags, 0);
# 7862| if (var_is_special)
# 7863|-> expand_no_split_dollar_star = oldex;
# 7864|
# 7865| t = w->word;
Error: COMPILER_WARNING (CWE-457):
bash-5.3/subst.c:8464:9: warning[-Wmaybe-uninitialized]: ‘a’ may be used uninitialized
# 8464 | len = assoc_p (v) ? assoc_num_elements (h) : array_num_elements (a);
bash-5.3/subst.c: scope_hint: In function ‘parameter_brace_substring’
bash-5.3/subst.c:8402:9: note: ‘a’ was declared here
# 8402 | ARRAY *a;
# | ^
# 8462| /* For arrays, the second offset deals with the number of elements. */
# 8463| if (vtype == VT_ARRAYVAR)
# 8464|-> len = assoc_p (v) ? assoc_num_elements (h) : array_num_elements (a);
# 8465| #endif
# 8466|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘shouldexp_replacement’
bash-5.3/subst.c:9160:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 9160 | while (c = s[sindex])
# | ^
# 9158| sindex = 0;
# 9159| slen = STRLEN (s);
# 9160|-> while (c = s[sindex])
# 9161| {
# 9162| if (c == '\\')
Error: COMPILER_WARNING (CWE-563):
bash-5.3/subst.c: scope_hint: In function ‘pat_subst’
bash-5.3/subst.c:9291:18: warning[-Wunused-variable]: unused variable ‘clen’
# 9291 | size_t clen;
# | ^~~~
# 9289| we increment one character to avoid infinite recursion. */
# 9290| char *p, *origp, *origs;
# 9291|-> size_t clen;
# 9292|
# 9293| RESIZE_MALLOCED_BUFFER (ret, rptr, locale_mb_cur_max, rsize, 64);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘parameter_brace_expand’
bash-5.3/subst.c:9865:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 9865 | if (c = string[sindex])
# | ^
# 9863| /* Find out what character ended the variable name. Then
# 9864| do the appropriate thing. */
# 9865|-> if (c = string[sindex])
# 9866| sindex++;
# 9867|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c:9875:11: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 9875 | if (c = string[sindex])
# | ^
# 9873| {
# 9874| check_nullness++;
# 9875|-> if (c = string[sindex])
# 9876| sindex++;
# 9877| }
Error: COMPILER_WARNING:
bash-5.3/subst.c:11274:7: warning[-Wunused-but-set-variable=]: variable ‘local_expanded’ set but not used
#11274 | int local_expanded;
# | ^~~~~~~~~~~~~~
#11272| int internal_tilde;
#11273| int split_on_spaces;
#11274|-> int local_expanded;
#11275| int tflag;
#11276| int pflags; /* flags passed to param_expand */
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/subst.c: scope_hint: In function ‘expand_word_internal’
bash-5.3/subst.c:11961:1: warning[-Wunused-label]: label ‘add_quoted_character’ defined but not used
#11961 | add_quoted_character:
# | ^~~~~~~~~~~~~~~~~~~~
#11959| if ((quoted&(Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) == 0)
#11960| has_quoted_ifs++;
#11961|-> add_quoted_character:
#11962| if (string[sindex]) /* from old goto dollar_add_string */
#11963| sindex++;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘string_quote_removal’
bash-5.3/subst.c:12219:29: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
#12219 | for (dquote = sindex = 0; c = string[sindex];)
# | ^
#12217| r = result_string = (char *)xmalloc (slen + 1);
#12218|
#12219|-> for (dquote = sindex = 0; c = string[sindex];)
#12220| {
#12221| switch (c)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/subst.c: scope_hint: In function ‘brace_expand_word_list’
bash-5.3/subst.c:12748:28: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
#12748 | for (eindex = 0; temp_string = expansions[eindex]; eindex++)
# | ^~~~~~~~~~~
#12746| }
#12747|
#12748|-> for (eindex = 0; temp_string = expansions[eindex]; eindex++)
#12749| {
#12750| w = alloc_word_desc ();
Error: COMPILER_WARNING (CWE-563):
bash-5.3/subst.c:12949:35: warning[-Wunused-variable]: unused variable ‘inheriting’
#12949 | int t, i_on, i_off, oind, skip, inheriting;
# | ^~~~~~~~~~
#12947| {
#12948| char opts_on[16], opts_off[16], omap[128];
#12949|-> int t, i_on, i_off, oind, skip, inheriting;
#12950| WORD_LIST *l;
#12951|
Error: COMPILER_WARNING (CWE-823):
bash-5.3/subst.c: scope_hint: In function ‘expand_declaration_argument’
bash-5.3/subst.c:12991:33: warning[-Wchar-subscripts]: array subscript has type ‘char’
#12991 | omap[l->word->word[oind]] |= (optchar == '-' ? 1 : 2);
# | ~~~~~~~~~~~~~^~~~~~
#12989| case 'u':
#12990| case 'c':
#12991|-> omap[l->word->word[oind]] |= (optchar == '-' ? 1 : 2);
#12992| break;
#12993| default:
Error: COMPILER_WARNING (CWE-569):
bash-5.3/support/bashversion.c: scope_hint: In function ‘main’
bash-5.3/support/bashversion.c:67:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 67 | if (progname = strrchr (argv[0], '/'))
# | ^~~~~~~~
# 65| char dv[128], *rv;
# 66|
# 67|-> if (progname = strrchr (argv[0], '/'))
# 68| progname++;
# 69| else
Error: COMPILER_WARNING (CWE-563):
bash-5.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/support/man2html.c: scope_hint: In function ‘read_man_page’
bash-5.3/support/man2html.c:517:17: warning[-Wunused-variable]: unused variable ‘i’
# 517 | int i;
# | ^
# 515| {
# 516| char *man_buf = NULL;
# 517|-> int i;
# 518| FILE *man_stream = NULL;
# 519| struct stat stbuf;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c:946:12: warning[-Wunused-variable]: ‘asint’ defined but not used
# 946 | static int asint = 0;
# | ^~~~~
# 944| }
# 945|
# 946|-> static int asint = 0;
# 947| static int intresult = 0;
# 948|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c:1448:17: warning[-Wunused-variable]: unused variable ‘t’
# 1448 | char *t, *h, *g;
# | ^
# 1446| scan_table(char *c)
# 1447| {
# 1448|-> char *t, *h, *g;
# 1449| int center = 0, expand = 0, box = 0, border = 0, linesize = 1;
# 1450| int i, j, maxcol = 0, finished = 0;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c: scope_hint: In function ‘scan_table’
bash-5.3/support/man2html.c:1453:44: warning[-Wunused-variable]: unused variable ‘ftable’
# 1453 | TABLEROW *layout = NULL, *currow, *ftable;
# | ^~~~~~
# 1451| int oldfont, oldsize, oldfillout;
# 1452| char itemsep = '\t';
# 1453|-> TABLEROW *layout = NULL, *currow, *ftable;
# 1454| TABLEITEM *curfield;
# 1455|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c: scope_hint: In function ‘scan_expression’
bash-5.3/support/man2html.c:1783:36: warning[-Wunused-variable]: unused variable ‘j’
# 1783 | int value = 0, value2, j = 0, sign = 1, opex = 0;
# | ^
# 1781| scan_expression(char *c, int *result)
# 1782| {
# 1783|-> int value = 0, value2, j = 0, sign = 1, opex = 0;
# 1784| char oper = 'c';
# 1785|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/support/man2html.c: scope_hint: In function ‘skip_till_newline’
bash-5.3/support/man2html.c:2160:19: warning[-Wparentheses]: suggest parentheses around ‘&&’ within ‘||’
# 2160 | while (*c && *c != '\n' || lvl > 0) {
# | ~~~^~~~~~~~~~~~~
# 2158| int lvl = 0;
# 2159|
# 2160|-> while (*c && *c != '\n' || lvl > 0) {
# 2161| if (*c == '\\') {
# 2162| c++;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c: scope_hint: In function ‘scan_request’
bash-5.3/support/man2html.c:2252:41: warning[-Wunused-variable]: unused variable ‘oldcurpos’
# 2252 | int oldcurpos = curpos;
# | ^~~~~~~~~
# 2250| {
# 2251| STRDEF *de;
# 2252|-> int oldcurpos = curpos;
# 2253|
# 2254| c = c + j;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c:2549:41: warning[-Wunused-variable]: unused variable ‘f’
# 2549 | FILE *f;
# | ^
# 2547| case V('s', 'o'):
# 2548| {
# 2549|-> FILE *f;
# 2550| struct stat stbuf;
# 2551| int l = 0;
Error: CPPCHECK_WARNING (CWE-786):
bash-5.3/support/man2html.c:2708: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 2706| curpos++;
# 2707| }
# 2708|-> wordlist[i][-1] = ' ';
# 2709| out_html(change_to_font(font[i & 1]));
# 2710| scan_troff(wordlist[i], 1, NULL);
Error: CPPCHECK_WARNING (CWE-786):
bash-5.3/support/man2html.c:2908: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 2906| char *t;
# 2907| for (i = 1; i < words; i++)
# 2908|-> wordlist[i][-1] = '\0';
# 2909| *sl = '\0';
# 2910| output_possible = 1;
Error: CPPCHECK_WARNING (CWE-786):
bash-5.3/support/man2html.c:2947: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 2945| out_html(change_to_font('I'));
# 2946| if (words > 1)
# 2947|-> wordlist[1][-1] = '\0';
# 2948| c = lookup_abbrev(wordlist[0]);
# 2949| curpos += strlen(c);
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/support/man2html.c:3108: warning[uninitvar]: Uninitialized variable: list_options
# 3106| strlimitcpy(list_options, c, nl - c, MED_STR_MAX);
# 3107| }
# 3108|-> if (strstr(list_options, "-bullet")) { /* HTML Unnumbered List */
# 3109| dl_set[itemdepth] = BL_BULLET_LIST;
# 3110| out_html("<UL>\n");
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/support/man2html.c:3241: warning[uninitvar]: Uninitialized variable: bd_options
# 3239| mandoc_bd_options = 0; /* Remember options for
# 3240| * terminating Bl */
# 3241|-> if (strstr(bd_options, "-offset indent")) {
# 3242| mandoc_bd_options |= BD_INDENT;
# 3243| out_html("<BLOCKQUOTE>\n");
Error: CPPCHECK_WARNING (CWE-786):
bash-5.3/support/man2html.c:3688: error[negativeIndex]: Array 'wordlist[100]' accessed at index wordlist[*][-1], which is out of bounds.
# 3686| *sl = '\0';
# 3687| for (i = 1; i < words; i++)
# 3688|-> wordlist[i][-1] = '\0';
# 3689| for (i = 0; i < words; i++) {
# 3690| char *h = NULL;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/support/man2html.c:3702:45: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3702 | for (i = 0; owndef->st[deflen + 2 + i] = owndef->st[i]; i++);
# | ^~~~~~
# 3700| wordlist[i] = NULL;
# 3701| deflen = strlen(owndef->st);
# 3702|-> for (i = 0; owndef->st[deflen + 2 + i] = owndef->st[i]; i++);
# 3703| oldargument = argument;
# 3704| argument = wordlist;
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/support/man2html.c: scope_hint: At top level
bash-5.3/support/man2html.c:3757:1: warning[-Wunused-function]: ‘flush’ defined but not used
# 3757 | flush(void)
# | ^~~~~
# 3755|
# 3756| static void
# 3757|-> flush(void)
# 3758| {
# 3759| }
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c:3772:17: warning[-Wunused-variable]: unused variable ‘i’
# 3772 | int i;
# | ^
# 3770| char intbuff[NULL_TERMINATED(MED_STR_MAX)];
# 3771| int ibp = 0;
# 3772|-> int i;
# 3773| char *exbuffer;
# 3774| int exbuffpos, exbuffmax, exscaninbuff, exnewline_for_fun;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c: scope_hint: In function ‘scan_troff’
bash-5.3/support/man2html.c:3831:33: warning[-Wunused-variable]: unused variable ‘mx’
# 3831 | int mx;
# | ^~
# 3829| h--;
# 3830| } else {
# 3831|-> int mx;
# 3832|
# 3833| if (h[-1] == '\n' && still_dd && isalnum(*h)) {
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c:4001:17: warning[-Wunused-variable]: unused variable ‘f’
# 4001 | FILE *f;
# | ^
# 3999| main(int argc, char **argv)
# 4000| {
# 4001|-> FILE *f;
# 4002| char *t;
# 4003| int l, i;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c:4003:17: warning[-Wunused-variable]: unused variable ‘l’
# 4003 | int l, i;
# | ^
# 4001| FILE *f;
# 4002| char *t;
# 4003|-> int l, i;
# 4004| char *buf;
# 4005| char *h, *fullname;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/support/man2html.c: scope_hint: In function ‘main’
bash-5.3/support/man2html.c:4005:21: warning[-Wunused-variable]: unused variable ‘fullname’
# 4005 | char *h, *fullname;
# | ^~~~~~~~
# 4003| int l, i;
# 4004| char *buf;
# 4005|-> char *h, *fullname;
# 4006| STRDEF *stdf;
# 4007|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/trap.c: scope_hint: In function ‘save_bash_trapsig’
bash-5.3/trap.c:301:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 301 | if (ret = get_string_value ("BASH_TRAPSIG"))
# | ^~~
# 299| char *ret;
# 300|
# 301|-> if (ret = get_string_value ("BASH_TRAPSIG"))
# 302| ret = savestring (ret);
# 303| return ret;
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/trap.c:486: error[legacyUninitvar]: Uninitialized variable: save_return_catch
# 484| if (return_catch_flag)
# 485| {
# 486|-> COPY_PROCENV (return_catch, save_return_catch);
# 487| function_code = setjmp_nosigs (return_catch);
# 488| }
Error: CPPCHECK_WARNING (CWE-457):
bash-5.3/trap.c:1189: error[uninitvar]: Uninitialized variable: save_return_catch
# 1187| if (return_catch_flag)
# 1188| {
# 1189|-> COPY_PROCENV (return_catch, save_return_catch);
# 1190| function_code = setjmp_nosigs (return_catch);
# 1191| }
Error: COMPILER_WARNING (CWE-569):
bash-5.3/unwind_prot.c: scope_hint: In function ‘unwind_frame_discard_internal’
bash-5.3/unwind_prot.c:232:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 232 | while (elt = unwind_protect_list)
# | ^~~
# 230|
# 231| found = 0;
# 232|-> while (elt = unwind_protect_list)
# 233| {
# 234| unwind_protect_list = unwind_protect_list->head.next;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/unwind_prot.c: scope_hint: In function ‘unwind_frame_run_internal’
bash-5.3/unwind_prot.c:267:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 267 | while (elt = unwind_protect_list)
# | ^~~
# 265|
# 266| found = 0;
# 267|-> while (elt = unwind_protect_list)
# 268| {
# 269| unwind_protect_list = elt->head.next;
Error: COMPILER_WARNING (CWE-563):
bash-5.3/variables.c:189:21: warning[-Wunused-variable]: ‘last_context_searched’ defined but not used
# 189 | static VAR_CONTEXT *last_context_searched;
# | ^~~~~~~~~~~~~~~~~~~~~
# 187|
# 188| static HASH_TABLE *last_table_searched; /* hash_lookup sets this */
# 189|-> static VAR_CONTEXT *last_context_searched;
# 190|
# 191| /* Some forward declarations. */
Error: COMPILER_WARNING (CWE-1164):
bash-5.3/variables.c: scope_hint: At top level
bash-5.3/variables.c:287:13: warning[-Wunused-function]: ‘init_shell_variable’ declared ‘static’ but never defined
# 287 | static void init_shell_variable (SHELL_VAR *);
# | ^~~~~~~~~~~~~~~~~~~
# 285| static SHELL_VAR *bind_variable_internal (const char *, const char *, HASH_TABLE *, int, int);
# 286|
# 287|-> static void init_shell_variable (SHELL_VAR *);
# 288|
# 289| static void dispose_variable_value (SHELL_VAR *);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘initialize_shell_variables’
bash-5.3/variables.c:428:15: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 428 | if (temp_var = find_function (tname))
# | ^~~~~~~~
# 426| free (temp_string); /* parse_and_execute does this */
# 427|
# 428|-> if (temp_var = find_function (tname))
# 429| {
# 430| VSETATTR (temp_var, (att_exported|att_imported));
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c:435:19: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 435 | if (temp_var = bind_invalid_envvar (name, string, 0))
# | ^~~~~~~~
# 433| else
# 434| {
# 435|-> if (temp_var = bind_invalid_envvar (name, string, 0))
# 436| {
# 437| VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
Error: COMPILER_WARNING:
bash-5.3/variables.c: scope_hint: In function ‘set_machine_vars’
bash-5.3/variables.c:721:14: warning[-Wunused-but-set-variable=]: variable ‘temp_var’ set but not used
# 721 | SHELL_VAR *temp_var;
# | ^~~~~~~~
# 719| set_machine_vars (void)
# 720| {
# 721|-> SHELL_VAR *temp_var;
# 722|
# 723| temp_var = set_if_not ("HOSTTYPE", HOSTTYPE);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘var_lookup’
bash-5.3/variables.c:1949:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 1949 | if (v = hash_lookup (name, vc->table))
# | ^
# 1947| v = (SHELL_VAR *)NULL;
# 1948| for (vc = vcontext; vc; vc = vc->down)
# 1949|-> if (v = hash_lookup (name, vc->table))
# 1950| break;
# 1951|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘delete_var’
bash-5.3/variables.c:3940:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3940 | if (elt = hash_remove (name, v->table, 0))
# | ^~~
# 3938|
# 3939| for (elt = (BUCKET_CONTENTS *)NULL, v = vc; v; v = v->down)
# 3940|-> if (elt = hash_remove (name, v->table, 0))
# 3941| break;
# 3942|
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘makunbound’
bash-5.3/variables.c:3967:9: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 3967 | if (elt = hash_remove (name, v->table, 0))
# | ^~~
# 3965|
# 3966| for (elt = (BUCKET_CONTENTS *)NULL, v = vc; v; v = v->down)
# 3967|-> if (elt = hash_remove (name, v->table, 0))
# 3968| break;
# 3969|
Error: COMPILER_WARNING (CWE-563):
bash-5.3/variables.c: scope_hint: In function ‘mk_env_string’
bash-5.3/variables.c:4724:15: warning[-Wunused-variable]: unused variable ‘isarray’
# 4724 | int isfunc, isarray;
# | ^~~~~~~
# 4722| size_t name_len, value_len;
# 4723| char *p, *q, *t;
# 4724|-> int isfunc, isarray;
# 4725|
# 4726| name_len = strlen (name);
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘make_env_array_from_var_list’
bash-5.3/variables.c:4858:31: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 4858 | for (i = 0, list_index = 0; var = vars[i]; i++)
# | ^~~
# 4856| list = strvec_create ((1 + strvec_len ((char **)vars)));
# 4857|
# 4858|-> for (i = 0, list_index = 0; var = vars[i]; i++)
# 4859| {
# 4860| #if defined (__CYGWIN__)
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘pop_var_context’
bash-5.3/variables.c:5358:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 5358 | if (ret = vcxt->down)
# | ^~~
# 5356| }
# 5357|
# 5358|-> if (ret = vcxt->down)
# 5359| {
# 5360| ret->up = (VAR_CONTEXT *)NULL;
Error: COMPILER_WARNING:
bash-5.3/variables.c: scope_hint: In function ‘pop_scope’
bash-5.3/variables.c:5452:7: warning[-Wunused-but-set-variable=]: variable ‘is_bltinenv’ set but not used
# 5452 | int is_bltinenv;
# | ^~~~~~~~~~~
# 5450| {
# 5451| VAR_CONTEXT *vcxt, *ret;
# 5452|-> int is_bltinenv;
# 5453|
# 5454| vcxt = shell_variables;
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘sv_history_control’
bash-5.3/variables.c:6125:10: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6125 | while (val = extract_colon_unit (temp, &tptr))
# | ^~~
# 6123|
# 6124| tptr = 0;
# 6125|-> while (val = extract_colon_unit (temp, &tptr))
# 6126| {
# 6127| if (STREQ (val, "ignorespace"))
Error: COMPILER_WARNING (CWE-569):
bash-5.3/variables.c: scope_hint: In function ‘sv_histtimefmt’
bash-5.3/variables.c:6172:7: warning[-Wparentheses]: suggest parentheses around assignment used as truth value
# 6172 | if (v = find_variable (name))
# | ^
# 6170| SHELL_VAR *v;
# 6171|
# 6172|-> if (v = find_variable (name))
# 6173| {
# 6174| if (history_comment_char == 0)
Error: COMPILER_WARNING:
bash-5.3/xmalloc.c:123:20: warning[-Walloc-size-larger-than=]: argument 2 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
# 123 | temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# | ^
/usr/include/stdlib.h: scope_hint: In function ‘shell_getc’
/usr/include/stdlib.h:687:14: note: in a call to allocation function ‘realloc’ declared here
# 687 | extern void *realloc (void *__ptr, size_t __size)
# | ^
# 121|
# 122| FINDBRK();
# 123|-> temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# 124|
# 125| if (temp == 0)
Error: COMPILER_WARNING:
bash-5.3/xmalloc.c:123:47: warning[-Walloc-size-larger-than=]: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807
# 123 | temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# | ^
/usr/include/stdlib.h: scope_hint: In function ‘shell_getc’
/usr/include/stdlib.h:676:14: note: in a call to allocation function ‘malloc’ declared here
# 676 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
# | ^
# 121|
# 122| FINDBRK();
# 123|-> temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
# 124|
# 125| if (temp == 0)