Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/whowatch-1.8.6/src/whowatch.c Examining data/whowatch-1.8.6/src/owner.c Examining data/whowatch-1.8.6/src/screen.c Examining data/whowatch-1.8.6/src/var.h Examining data/whowatch-1.8.6/src/kbd.h Examining data/whowatch-1.8.6/src/proctree.c Examining data/whowatch-1.8.6/src/proctree.h Examining data/whowatch-1.8.6/src/list.h Examining data/whowatch-1.8.6/src/ulist.h Examining data/whowatch-1.8.6/src/proc_plugin.c Examining data/whowatch-1.8.6/src/block.c Examining data/whowatch-1.8.6/src/plist.c Examining data/whowatch-1.8.6/src/wdgts.c Examining data/whowatch-1.8.6/src/procinfo.h Examining data/whowatch-1.8.6/src/pluglib.h Examining data/whowatch-1.8.6/src/kbd.c Examining data/whowatch-1.8.6/src/pluglib.c Examining data/whowatch-1.8.6/src/whowatch.h Examining data/whowatch-1.8.6/src/ulist.c Examining data/whowatch-1.8.6/src/exti.c Examining data/whowatch-1.8.6/src/procinfo.c Examining data/whowatch-1.8.6/src/user_plugin.c FINAL RESULTS: data/whowatch-1.8.6/src/proc_plugin.c:53:5: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. if(readlink(path, buf, sizeof buf) == -1) data/whowatch-1.8.6/src/block.c:30:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(logfile, t, ap); data/whowatch-1.8.6/src/pluglib.c:13:6: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. n = vsnprintf(buf, sizeof buf, t, ap); data/whowatch-1.8.6/src/pluglib.c:29:6: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. n = vsnprintf(buf, sizeof buf, t, ap); data/whowatch-1.8.6/src/pluglib.c:56:6: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. n = vsnprintf(buf, sizeof buf, t, ap); data/whowatch-1.8.6/src/procinfo.c:318:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"/dev/%s",tty); data/whowatch-1.8.6/src/proctree.c:63:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(name+sizeof PROCDIR,"%s/stat",e->d_name); data/whowatch-1.8.6/src/block.c:22:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). logfile = fopen("/var/log/whowatch.log", "a"); data/whowatch-1.8.6/src/owner.c:16:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[NAME_SIZE + 1]; data/whowatch-1.8.6/src/owner.c:47:10: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. if (!u) sprintf(p->name, "%d", n); data/whowatch-1.8.6/src/plist.c:177:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *tmp, buf[8]; data/whowatch-1.8.6/src/pluglib.c:10:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[SUBWIN_COLS]; data/whowatch-1.8.6/src/pluglib.c:26:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[SUBWIN_COLS]; data/whowatch-1.8.6/src/pluglib.c:52:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[SUBWIN_COLS]; data/whowatch-1.8.6/src/proc_plugin.c:51:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[128]; data/whowatch-1.8.6/src/proc_plugin.c:61:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char pbuf[32]; data/whowatch-1.8.6/src/proc_plugin.c:150:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(t, src, sizeof *t); data/whowatch-1.8.6/src/proc_plugin.c:178:1: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((char*)&t + offset, (char*)tmp + offset, sizeof(t) - offset); data/whowatch-1.8.6/src/proc_plugin.c:196:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[127], *tmp; data/whowatch-1.8.6/src/proc_plugin.c:205:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!(f = fopen("/proc/net/tcp", "r"))) return; data/whowatch-1.8.6/src/proc_plugin.c:227:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64]; data/whowatch-1.8.6/src/proc_plugin.c:274:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/whowatch-1.8.6/src/proc_plugin.c:315:6: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen(name, "r"); data/whowatch-1.8.6/src/proc_plugin.c:336:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[128]; data/whowatch-1.8.6/src/proc_plugin.c:343:6: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen(name, "r"); data/whowatch-1.8.6/src/proc_plugin.c:363:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/whowatch-1.8.6/src/proc_plugin.c:376:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/whowatch-1.8.6/src/proc_plugin.c:381:6: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen(buf, "r"); data/whowatch-1.8.6/src/proc_plugin.c:399:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/whowatch-1.8.6/src/proc_plugin.c:404:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!(f = fopen("/proc/stat", "r"))) return boot_time; data/whowatch-1.8.6/src/proc_plugin.c:485:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64]; data/whowatch-1.8.6/src/proc_plugin.c:490:6: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f = fopen(buf, "r"); data/whowatch-1.8.6/src/proc_plugin.c:523:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64]; data/whowatch-1.8.6/src/procinfo.c:29:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char exec_file[EXEC_FILE+1]; /* executable name */ data/whowatch-1.8.6/src/procinfo.c:38:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/whowatch-1.8.6/src/procinfo.c:50:2: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(p->exec_file, "can't access"); data/whowatch-1.8.6/src/procinfo.c:52:12: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!(f = fopen(buf,"rt"))) data/whowatch-1.8.6/src/procinfo.c:80:2: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(p->exec_file, "can't access"); data/whowatch-1.8.6/src/procinfo.c:111:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/whowatch-1.8.6/src/procinfo.c:136:10: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). return atoi(tty+3); data/whowatch-1.8.6/src/procinfo.c:195:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[512]; data/whowatch-1.8.6/src/procinfo.c:201:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if((fd = open(buf, O_RDONLY)) == -1) data/whowatch-1.8.6/src/procinfo.c:216:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, s, n); data/whowatch-1.8.6/src/procinfo.c:235:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[512]; data/whowatch-1.8.6/src/procinfo.c:242:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, info.kinfo_comm, sizeof buf - 1); data/whowatch-1.8.6/src/procinfo.c:285:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/whowatch-1.8.6/src/procinfo.c:298:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if(!(f = fopen("/proc/loadavg", "r"))) return ret; data/whowatch-1.8.6/src/procinfo.c:315:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[32]; data/whowatch-1.8.6/src/procinfo.c:324:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf,"%ldd", (long) idle_time/(3600 * 24) ); data/whowatch-1.8.6/src/procinfo.c:327:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf,"%ld:%02ld", (long)idle_time/3600, (long) min); data/whowatch-1.8.6/src/procinfo.c:330:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf,"%ld", (long) idle_time/60); data/whowatch-1.8.6/src/proctree.c:52:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char name[32] = PROCDIR "/"; data/whowatch-1.8.6/src/proctree.c:57:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64],*p; data/whowatch-1.8.6/src/proctree.c:64:5: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). f=open(name,0); data/whowatch-1.8.6/src/proctree.c:72:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). i->ppid = atoi(p); data/whowatch-1.8.6/src/proctree.c:73:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). i->pid = atoi(buf); data/whowatch-1.8.6/src/proctree.c:243:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[TREE_STRING_SZ]; data/whowatch-1.8.6/src/ulist.c:115:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(UTMP_FILE ,O_RDONLY)) == -1) err_exit(1, "Cannot open utmp"); data/whowatch-1.8.6/src/ulist.c:157:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[64]; data/whowatch-1.8.6/src/ulist.c:167:17: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if((*wtmp_fd = open(WTMP_FILE ,O_RDONLY)) == -1) err_exit(1, "Cannot open wtmp"); data/whowatch-1.8.6/src/ulist.h:19:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[UT_NAMESIZE + 1]; data/whowatch-1.8.6/src/ulist.h:20:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tty[UT_LINESIZE + 1]; data/whowatch-1.8.6/src/ulist.h:22:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char parent[16]; data/whowatch-1.8.6/src/ulist.h:23:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char host[UT_HOSTSIZE + 1]; data/whowatch-1.8.6/src/wdgts.c:20:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char errbuf[64]; data/whowatch-1.8.6/src/wdgts.c:154:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[32]; data/whowatch-1.8.6/src/whowatch.c:149:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[64]; data/whowatch-1.8.6/src/whowatch.c:155:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf,"Can't send signal %d to process %d", data/whowatch-1.8.6/src/whowatch.c:157:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. else sprintf(buf,"Signal %d was sent to process %d",sig, pid); data/whowatch-1.8.6/src/whowatch.c:278:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(w->name, name, sizeof w->name - 1); data/whowatch-1.8.6/src/whowatch.h:88:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char name[8]; /* debugging identification */ data/whowatch-1.8.6/src/block.c:27:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *(c + strlen(c) - 1) = 0; data/whowatch-1.8.6/src/kbd.c:295:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). v = read(0, p, l); data/whowatch-1.8.6/src/owner.c:49:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p->name, u->pw_name, NAME_SIZE); data/whowatch-1.8.6/src/proc_plugin.c:209:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). i = strlen(buf) - 1; data/whowatch-1.8.6/src/proc_plugin.c:317:13: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((i = fgetc(f)) != EOF) { data/whowatch-1.8.6/src/proc_plugin.c:320:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((i = fgetc(f)) == ' '); data/whowatch-1.8.6/src/proc_plugin.c:341:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(start) slen = strlen(start); data/whowatch-1.8.6/src/proc_plugin.c:342:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(end) elen = strlen(end); data/whowatch-1.8.6/src/proc_plugin.c:383:13: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((i = fgetc(f)) != EOF) { data/whowatch-1.8.6/src/procinfo.c:54:5: [1] (buffer) fscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if(fscanf(f,"%*d %128s %*c %d %*d %*d %*d %d", data/whowatch-1.8.6/src/procinfo.c:88:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p->exec_file, info.kinfo_comm, EXEC_FILE); data/whowatch-1.8.6/src/procinfo.c:152:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). l = strlen(info[i].kinfo_comm); data/whowatch-1.8.6/src/procinfo.c:203:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, buf, sizeof buf); data/whowatch-1.8.6/src/procinfo.c:213:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). n = strlen(p.exec_file); data/whowatch-1.8.6/src/procinfo.c:250:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, *p, endof(buf) - s); data/whowatch-1.8.6/src/procinfo.c:251:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen(*p); data/whowatch-1.8.6/src/procinfo.c:332:3: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. sprintf(buf," "); data/whowatch-1.8.6/src/proctree.c:66:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n=read(f,buf,63); data/whowatch-1.8.6/src/screen.c:42:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). l = strlen(s); data/whowatch-1.8.6/src/ulist.c:30:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if(strncmp(t->s, name, strlen(t->s))) continue; data/whowatch-1.8.6/src/ulist.c:58:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(u->name, entry->ut_user, UT_NAMESIZE); data/whowatch-1.8.6/src/ulist.c:59:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(u->tty, entry->ut_line, UT_LINESIZE); data/whowatch-1.8.6/src/ulist.c:60:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(u->host, entry->ut_host, UT_HOSTSIZE); data/whowatch-1.8.6/src/ulist.c:67:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(u->parent, "can't access", sizeof u->parent); data/whowatch-1.8.6/src/ulist.c:68:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). else strncpy(u->parent, get_name(ppid), sizeof u->parent - 1); data/whowatch-1.8.6/src/ulist.c:116:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((i = read(fd, &entry,sizeof entry)) > 0) { data/whowatch-1.8.6/src/ulist.c:183:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((i = read(wtmp_fd, &entry, sizeof entry)) > 0){ data/whowatch-1.8.6/src/wdgts.c:145:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). cx = cxs = strlen(hint); data/whowatch-1.8.6/src/wdgts.c:146:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). scr_maddstr(w, hint, 0, 0, strlen(hint)+1); data/whowatch-1.8.6/src/wdgts.c:171:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). scr_maddstr(w, d, 1, w->x, strlen(d)+1); data/whowatch-1.8.6/src/wdgts.c:182:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). n = strlen(s); data/whowatch-1.8.6/src/whowatch.c:423:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(10000); ANALYSIS SUMMARY: Hits = 103 Lines analyzed = 4319 in approximately 0.11 seconds (38252 lines/second) Physical Source Lines of Code (SLOC) = 3383 Hits@level = [0] 35 [1] 32 [2] 64 [3] 0 [4] 6 [5] 1 Hits@level+ = [0+] 138 [1+] 103 [2+] 71 [3+] 7 [4+] 7 [5+] 1 Hits/KSLOC@level+ = [0+] 40.7922 [1+] 30.4463 [2+] 20.9873 [3+] 2.06917 [4+] 2.06917 [5+] 0.295596 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.