Task #222 - psmisc-23.6-6.fc40/scan-results.err
back to task #222download
Error: GCC_ANALYZER_WARNING (CWE-401): psmisc-23.6/src/fuser.c: scope_hint: In function ‘add_matched_proc’ psmisc-23.6/src/fuser.c:442:8: warning[-Wanalyzer-malloc-leak]: leak of ‘pptr’ # 440| if (pathname) # 441| free(pathname); # 442|-> if (fp) # 443| fclose(fp); # 444| } Error: CLANG_WARNING: psmisc-23.6/src/fuser.c:2169:18: warning[deadcode.DeadStores]: Although the value stored to 'end' is used in the enclosing expression, the value is never actually read from 'end' # 2167| } # 2168| # 2169|-> for (start = end = path; *start; start = end) # 2170| { # 2171| while (*start == '/') Error: CLANG_WARNING: psmisc-23.6/src/fuser.c:2226:13: warning[deadcode.DeadStores]: Value stored to 'path' is never read # 2224| # 2225| memmove(&tmpbuf[n], end, len + 1); # 2226|-> path = end = memcpy(tmpbuf, lnkbuf, n); # 2227| # 2228| if (lnkbuf[0] == '/') Error: CLANG_WARNING: psmisc-23.6/src/killall.c:305:2: warning[core.CallAndMessage]: Called function pointer is null (null dereference) # 303| if (my_getpidcon && selinux_enabled && !my_getpidcon(pid, &lcontext)) { # 304| retval = (regexec(scontext, lcontext, 0, NULL, 0) ==0); # 305|-> my_freecon(lcontext); # 306| } else { # 307| FILE *file; Error: GCC_ANALYZER_WARNING (CWE-401): psmisc-23.6/src/killall.c: scope_hint: In function ‘load_process_name_and_age’ psmisc-23.6/src/killall.c:414:16: warning[-Wanalyzer-malloc-leak]: leak of ‘file’ # 412| # 413| if ( (fd = openat(pidfd, "stat", O_RDONLY, 0)) < 0) # 414|-> return -1; # 415| if (!(file = fdopen (fd, "r"))) # 416| { Error: GCC_ANALYZER_WARNING (CWE-457): psmisc-23.6/src/killall.c: scope_hint: In function ‘load_proc_cmdline’ psmisc-23.6/src/killall.c:503:33: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*command_buf’ # 501| } # 502| } # 503|-> if (strlen(command_buf) == 0) { # 504| okay = 0; # 505| break; Error: GCC_ANALYZER_WARNING (CWE-401): psmisc-23.6/src/killall.c:530:15: warning[-Wanalyzer-malloc-leak]: leak of ‘file’ # 528| return -1; # 529| } # 530|-> *got_long = okay; # 531| return 0; # 532| } Error: GCC_ANALYZER_WARNING (CWE-401): psmisc-23.6/src/killall.c: scope_hint: In function ‘create_pid_table’ psmisc-23.6/src/killall.c:550:8: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/proc")’ # 548| *max_pids = 256; # 549| pid_table = malloc (*max_pids * sizeof (pid_t)); # 550|-> if (!pid_table) # 551| { # 552| perror ("malloc"); Error: GCC_ANALYZER_WARNING (CWE-401): psmisc-23.6/src/killall.c: scope_hint: In function ‘kill_all’ psmisc-23.6/src/killall.c:558:37: warning[-Wanalyzer-malloc-leak]: leak of ‘create_pid_table(&max_pids, & pids)’ # 556| while ( (de = readdir (dir)) != NULL) # 557| { # 558|-> if (!(pid = (pid_t) atoi (de->d_name)) || pid == self) # 559| continue; # 560| if (*pids == *max_pids) Error: CLANG_WARNING: psmisc-23.6/src/killall.c:758:22: warning[core.NullDereference]: Array access (from variable 'pgids') results in a null pointer dereference # 756| # 757| id = getpgid (pid_table[i]); # 758|-> pgids[i] = id; # 759| if (id < 0) # 760| { Error: CLANG_WARNING: psmisc-23.6/src/killall.c:800:32: warning[core.BitwiseShift]: Right operand is negative in left shift # 798| /* killall returns a zero return code if at least one process has # 799| * been killed for each listed command. */ # 800|-> error = found == ((1UL << (name_count - 1)) | ((1UL << (name_count - 1)) - 1)) ? 0 : 1; # 801| else # 802| /* in nameless mode killall returns a zero return code if at least Error: CLANG_WARNING: psmisc-23.6/src/killall.c:938:9: warning[deadcode.DeadStores]: Value stored to 'name' is never read # 936| name++; # 937| else # 938|-> name = *argv; # 939| sig_num = SIGTERM; # 940| Error: GCC_ANALYZER_WARNING (CWE-479): psmisc-23.6/src/peekfd.c: scope_hint: In function ‘detach’ psmisc-23.6/src/peekfd.c:173:17: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘free’ from within signal handler # 171| ptrace(PTRACE_DETACH, attached_pids[i], 0, 0); # 172| if (fds) # 173|-> free(fds); # 174| signal(SIGINT, SIG_DFL); # 175| raise(SIGINT); Error: CPPCHECK_WARNING (CWE-401): psmisc-23.6/src/pstree.c:359: error[memleakOnRealloc]: Common realloc mistake: 'width' nulled but not freed upon failure # 357| else # 358| capacity *= 2; # 359|-> if (!(width = realloc(width, capacity * sizeof(int)))) { # 360| perror("realloc"); # 361| exit(1); Error: CPPCHECK_WARNING (CWE-401): psmisc-23.6/src/pstree.c:363: error[memleakOnRealloc]: Common realloc mistake: 'more' nulled but not freed upon failure # 361| exit(1); # 362| } # 363|-> if (!(more = realloc(more, capacity * sizeof(int)))) { # 364| perror("realloc"); # 365| exit(1); Error: CLANG_WARNING: psmisc-23.6/src/pstree.c:506:9: warning[core.CallAndMessage]: Called function pointer is null (null dereference) # 504| if (my_getpidcon && selinux_enabled && !my_getpidcon(current->pid, &context)) { # 505| out_string(context); # 506|-> my_freecon(context); # 507| ret = true; # 508| } Error: CLANG_WARNING: psmisc-23.6/src/pstree.c:903:9: warning[deadcode.DeadStores]: Value stored to 'count' is never read # 901| { # 902| width[level] = swapped + (comm_len > 1 ? 0 : -1); # 903|-> count=0; # 904| first=1; # 905| for (walk = current->children; walk; walk = next) { Error: CLANG_WARNING: psmisc-23.6/src/pstree.c:904:9: warning[deadcode.DeadStores]: Value stored to 'first' is never read # 902| width[level] = swapped + (comm_len > 1 ? 0 : -1); # 903| count=0; # 904|-> first=1; # 905| for (walk = current->children; walk; walk = next) { # 906| next = walk->next; Error: GCC_ANALYZER_WARNING (CWE-775): psmisc-23.6/src/pstree.c: scope_hint: In function ‘read_proc’ psmisc-23.6/src/pstree.c:1161:33: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "r")’ psmisc-23.6/src/pstree.c:40: included_from: Included from here. # 1159| int thread; # 1160| # 1161|-> process_age_sec = process_age(proc_stt_jf); # 1162| /* handle process threads */ # 1163| if (! hide_threads) { Error: GCC_ANALYZER_WARNING (CWE-401): psmisc-23.6/src/pstree.c:1161:33: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "r")’ # 1159| int thread; # 1160| # 1161|-> process_age_sec = process_age(proc_stt_jf); # 1162| /* handle process threads */ # 1163| if (! hide_threads) { Error: CLANG_WARNING: psmisc-23.6/src/pstree.c:1222:34: warning[core.NullDereference]: Array access (from variable 'buffer') results in a null pointer dereference # 1220| size--; # 1221| if (size) # 1222|-> buffer[size++] = 0; # 1223| add_proc(comm, pid, ppid, pgid, st.st_uid, # 1224| buffer, size, 0, process_age_sec); Error: CLANG_WARNING: psmisc-23.6/src/statx.c:57:11: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 55| ret = syscall(SYS_statx, dirfd, pathname, flags, mask, &stx); # 56| #else # 57|-> ret = statx(dirfd, pathname, flags, mask, &stx); # 58| #endif # 59| if (ret >= 0) { Error: CLANG_WARNING: psmisc-23.6/src/statx.c:126:11: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 124| ret = syscall(SYS_statx, dirfd, pathname, flags, mask, &stx); # 125| #else # 126|-> ret = statx(dirfd, pathname, flags, mask, &stx); # 127| #endif # 128| if (ret >= 0) {