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/lxtask-0.1.10/src/functions.h Examining data/lxtask-0.1.10/src/callbacks.c Examining data/lxtask-0.1.10/src/interface.c Examining data/lxtask-0.1.10/src/xfce-taskmanager-linux.c Examining data/lxtask-0.1.10/src/types.h Examining data/lxtask-0.1.10/src/utils.h Examining data/lxtask-0.1.10/src/interface.h Examining data/lxtask-0.1.10/src/utils.c Examining data/lxtask-0.1.10/src/main.c Examining data/lxtask-0.1.10/src/functions.c Examining data/lxtask-0.1.10/src/xfce-taskmanager-linux.h Examining data/lxtask-0.1.10/src/callbacks.h FINAL RESULTS: data/lxtask-0.1.10/src/utils.c:119:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( buf, "%u %s", ( guint ) size, unit ); data/lxtask-0.1.10/src/utils.c:123:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( buf, "%.1f %s", val, unit ); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:145:3: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(p, "%1s %ld %s %s %s %s %s %s %s %s %s %i %i %s %s %s %i", data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:243:10: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if ( fscanf (file, "cpu\t%"G_GUINT64_FORMAT" %"G_GUINT64_FORMAT" %"G_GUINT64_FORMAT" %"G_GUINT64_FORMAT, data/lxtask-0.1.10/src/callbacks.c:84:20: [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). if(atoi(task_id)==getpid() && task_action==SIGNAL_STOP) data/lxtask-0.1.10/src/callbacks.c:90:41: [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). send_signal_to_task(atoi(task_id), task_action); data/lxtask-0.1.10/src/callbacks.c:108:30: [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). set_priority_to_task(atoi(task_id), atoi(prio)); data/lxtask-0.1.10/src/callbacks.c:108:45: [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). set_priority_to_task(atoi(task_id), atoi(prio)); data/lxtask-0.1.10/src/functions.c:45:5: [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 tooltip[256]; data/lxtask-0.1.10/src/functions.c:149:5: [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 (tooltip, _("Memory: %d MB of %d MB used"), (int)(memory_used / 1024), data/lxtask-0.1.10/src/functions.c:158:5: [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 (tooltip,_("CPU usage: %0.0f %%"), cpu_usage * 100.0); data/lxtask-0.1.10/src/functions.c:314:15: [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). rc_file = fopen( config_file, "w" ); data/lxtask-0.1.10/src/interface.c:449: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. char buf[32]; data/lxtask-0.1.10/src/interface.c:453:9: [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,"%u",(guint)task->pid); data/lxtask-0.1.10/src/interface.c:455:9: [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,"%u",(guint)task->ppid); data/lxtask-0.1.10/src/interface.c:466:9: [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,"%0d%%", (guint)task->time_percentage); data/lxtask-0.1.10/src/interface.c:468:9: [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,"%d",task->prio); data/lxtask-0.1.10/src/interface.c:491:37: [2] (integer) atol: 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). if(str_data && task->pid == atol(str_data)) data/lxtask-0.1.10/src/interface.c:513:31: [2] (integer) atol: 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). if(str_data && pid == atol(str_data)) data/lxtask-0.1.10/src/interface.c:539:14: [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). i1 = atoi(s1); data/lxtask-0.1.10/src/interface.c:541:14: [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). i2 = atoi(s2); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:44:2: [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(line,"/proc/%d/statm",(int)pid); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:45: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). fd=open(line,O_RDONLY); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:60:2: [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(line,"/proc/%d/stat",(gint)pid); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:61: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). fd=open(line,O_RDONLY); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:66: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[2048],*p,*e; data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:101:4: [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(line,"/proc/%d/cmdline",(int)pid); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:102:7: [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). fp=fopen(line,"r"); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:127:4: [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(line,"/proc/%d/cmdline",(int)pid); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:128:7: [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). fp=fopen(line,"r"); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:172: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(line,"/proc/%d/task",(int)pid); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:206:21: [2] (integer) atol: 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). pid_t pid = atol(namelist[n]->d_name); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:241: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). file = fopen (file_name, "rb"); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:263: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). file = fopen ("/proc/meminfo", "r"); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:274:33: [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). sys_stat->mem_total=atoi(buffer+10),reach++; data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:276:32: [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). sys_stat->mem_free=atoi(buffer+9),reach++; data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:278:35: [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). sys_stat->mem_cached+=atoi(buffer+8),reach++; data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:280:28: [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). sys_stat->mem_cached+=atoi(buffer+14),reach++; data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:282:36: [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). sys_stat->mem_buffered=atoi(buffer+9),reach++; data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:47:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd,line,255); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:74:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret=read(fd,buf,2048-1); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:95:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(task->name, p, len); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:132:9: [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(fp, "%255s", line) > 0) data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:136:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(task->name, p+1, sizeof(task->name)-1); data/lxtask-0.1.10/src/xfce-taskmanager-linux.c:138:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(task->name, line, sizeof(task->name)-1); ANALYSIS SUMMARY: Hits = 45 Lines analyzed = 2058 in approximately 0.08 seconds (25989 lines/second) Physical Source Lines of Code (SLOC) = 1438 Hits@level = [0] 12 [1] 6 [2] 35 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 57 [1+] 45 [2+] 39 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 39.6384 [1+] 31.2935 [2+] 27.121 [3+] 2.78164 [4+] 2.78164 [5+] 0 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.