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/evdi-1.7.0+dfsg/library/evdi_lib.c Examining data/evdi-1.7.0+dfsg/library/evdi_lib.h Examining data/evdi-1.7.0+dfsg/module/evdi_connector.c Examining data/evdi-1.7.0+dfsg/module/evdi_cursor.c Examining data/evdi-1.7.0+dfsg/module/evdi_cursor.h Examining data/evdi-1.7.0+dfsg/module/evdi_debug.c Examining data/evdi-1.7.0+dfsg/module/evdi_debug.h Examining data/evdi-1.7.0+dfsg/module/evdi_drm.h Examining data/evdi-1.7.0+dfsg/module/evdi_drv.c Examining data/evdi-1.7.0+dfsg/module/evdi_drv.h Examining data/evdi-1.7.0+dfsg/module/evdi_encoder.c Examining data/evdi-1.7.0+dfsg/module/evdi_fb.c Examining data/evdi-1.7.0+dfsg/module/evdi_gem.c Examining data/evdi-1.7.0+dfsg/module/evdi_ioc32.c Examining data/evdi-1.7.0+dfsg/module/evdi_main.c Examining data/evdi-1.7.0+dfsg/module/evdi_modeset.c Examining data/evdi-1.7.0+dfsg/module/evdi_painter.c Examining data/evdi-1.7.0+dfsg/module/evdi_params.c Examining data/evdi-1.7.0+dfsg/module/evdi_params.h FINAL RESULTS: data/evdi-1.7.0+dfsg/library/evdi_lib.c:244:6: [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. r = readlink(link, real_path, sizeof(real_path)); data/evdi-1.7.0+dfsg/library/evdi_lib.c:39:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("[libevdi] " __VA_ARGS__); \ data/evdi-1.7.0+dfsg/library/evdi_lib.c:139:3: [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(*node, frame_buffer, sizeof(struct evdi_buffer)); data/evdi-1.7.0+dfsg/library/evdi_lib.c:208: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[64] = { 0 }, date[64] = { 0 }, desc[64] = { 0 }; data/evdi-1.7.0+dfsg/library/evdi_lib.c:233: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 dev[PATH_MAX] = ""; data/evdi-1.7.0+dfsg/library/evdi_lib.c:241: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 real_path[PATH_MAX]; data/evdi-1.7.0+dfsg/library/evdi_lib.c:254: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 maps_path[PATH_MAX]; data/evdi-1.7.0+dfsg/library/evdi_lib.c:256: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 line[BUFSIZ]; data/evdi-1.7.0+dfsg/library/evdi_lib.c:261:9: [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). maps = fopen(maps_path, "r"); data/evdi-1.7.0+dfsg/library/evdi_lib.c:278: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 fd_path[PATH_MAX]; data/evdi-1.7.0+dfsg/library/evdi_lib.c:291: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 path[PATH_MAX]; data/evdi-1.7.0+dfsg/library/evdi_lib.c:321: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). || myself == atoi(d_name)) { data/evdi-1.7.0+dfsg/library/evdi_lib.c:361:7: [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(device_path, O_RDWR); data/evdi-1.7.0+dfsg/library/evdi_lib.c:408: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 dev[PATH_MAX] = ""; data/evdi-1.7.0+dfsg/library/evdi_lib.c:456: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 card_path[PATH_MAX]; data/evdi-1.7.0+dfsg/library/evdi_lib.c:486: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 path[PATH_MAX]; data/evdi-1.7.0+dfsg/library/evdi_lib.c:493:22: [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 *add_devices = fopen("/sys/devices/evdi/add", "w"); data/evdi-1.7.0+dfsg/library/evdi_lib.c:543: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 path[PATH_MAX] = {0}; data/evdi-1.7.0+dfsg/library/evdi_lib.c:561: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). cursor_evs = fopen(path, "w"); data/evdi-1.7.0+dfsg/library/evdi_lib.c:715:4: [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(cursor_set.buffer, ptr, size); data/evdi-1.7.0+dfsg/library/evdi_lib.c:803: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 buffer[1024]; data/evdi-1.7.0+dfsg/module/evdi_debug.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 task_comm[TASK_COMM_LEN] = { 0 }; data/evdi-1.7.0+dfsg/module/evdi_debug.c:21: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 process_comm[TASK_COMM_LEN] = { 0 }; data/evdi-1.7.0+dfsg/module/evdi_fb.c:407: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(info->fix.id, "evdidrmfb"); data/evdi-1.7.0+dfsg/module/evdi_painter.c:225:4: [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(block, data/evdi-1.7.0+dfsg/module/evdi_painter.c:626: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(&painter->dirty_rects[painter->num_dirts], &rect, sizeof(rect)); data/evdi-1.7.0+dfsg/module/evdi_painter.c:922: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(dirty_rects, painter->dirty_rects, data/evdi-1.7.0+dfsg/library/evdi_lib.c:350:3: [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(SLEEP_INTERVAL_US); data/evdi-1.7.0+dfsg/library/evdi_lib.c:399:3: [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(SLEEP_INTERVAL_US); data/evdi-1.7.0+dfsg/library/evdi_lib.c:559: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). path_len = strlen(path); data/evdi-1.7.0+dfsg/library/evdi_lib.c:806:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int bytesRead = read(handle->fd, buffer, sizeof(buffer)); ANALYSIS SUMMARY: Hits = 31 Lines analyzed = 5072 in approximately 0.12 seconds (43203 lines/second) Physical Source Lines of Code (SLOC) = 3870 Hits@level = [0] 12 [1] 4 [2] 25 [3] 0 [4] 1 [5] 1 Hits@level+ = [0+] 43 [1+] 31 [2+] 27 [3+] 2 [4+] 2 [5+] 1 Hits/KSLOC@level+ = [0+] 11.1111 [1+] 8.01034 [2+] 6.97674 [3+] 0.516796 [4+] 0.516796 [5+] 0.258398 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.