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/udevil-0.4.4/src/canonicalize.c Examining data/udevil-0.4.4/src/canonicalize.h Examining data/udevil-0.4.4/src/device-info.c Examining data/udevil-0.4.4/src/device-info.h Examining data/udevil-0.4.4/src/udevil.c FINAL RESULTS: data/udevil-0.4.4/src/canonicalize.c:96:7: [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. n = readlink(resolved_path, link_path, PATH_MAX); data/udevil-0.4.4/src/device-info.c:195:9: [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. num = readlink (full_path, link_path, sizeof(link_path) - 1); data/udevil-0.4.4/src/udevil.c:1103:21: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod( path_new, S_IRWXU ); data/udevil-0.4.4/src/udevil.c:1165:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod( logfile, S_IRWXU ); data/udevil-0.4.4/src/udevil.c:2358:5: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown( AUTO_MEDIA_DIR, 0, 0 ); data/udevil-0.4.4/src/udevil.c:2360:5: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown( auto_media, 0, 0 ); data/udevil-0.4.4/src/udevil.c:2387:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. chown( auto_media, orig_ruid, 0 ); data/udevil-0.4.4/src/udevil.c:2388:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod( auto_media, S_IRWXU ); data/udevil-0.4.4/src/udevil.c:4277:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod( point, mode ); data/udevil-0.4.4/src/device-info.c:907:11: [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. if (sscanf (lines[n], data/udevil-0.4.4/src/device-info.c:940:22: [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. if ( sscanf( sep + 3, "%s %s", typebuf, mount_source ) == 2 && data/udevil-0.4.4/src/udevil.c:182:14: [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. if ( sscanf( lines[n], data/udevil-0.4.4/src/udevil.c:934:13: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf( stderr, msg, sub1 ); data/udevil-0.4.4/src/udevil.c:936:13: [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( msg, sub1 ); data/udevil-0.4.4/src/udevil.c:1156:14: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. if ( fprintf( file, logmem, NULL ) < 1 ) data/udevil-0.4.4/src/udevil.c:1781:14: [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. if ( sscanf( lines[n], data/udevil-0.4.4/src/udevil.c:1844:14: [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. if ( sscanf( lines[n], data/udevil-0.4.4/src/udevil.c:1904:14: [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. if ( sscanf( lines[n], data/udevil-0.4.4/src/udevil.c:2114:9: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf( stderr, sstderr, NULL ); data/udevil-0.4.4/src/udevil.c:2116:9: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf( stdout, sstdout, NULL ); data/udevil-0.4.4/src/udevil.c:4167:13: [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( str, NULL ); data/udevil-0.4.4/src/device-info.c:205:11: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath (absolute_path, resolved_path) != NULL) data/udevil-0.4.4/src/udevil.c:500:19: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (!(value = getenv(var))) continue; data/udevil-0.4.4/src/udevil.c:506:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (!(value = getenv(var))) continue; data/udevil-0.4.4/src/udevil.c:524:19: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (!(value = getenv(var))) continue; data/udevil-0.4.4/src/udevil.c:535:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (!(value = getenv(var))) continue; data/udevil-0.4.4/src/udevil.c:5099:5: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand( (unsigned int)time( 0 ) + getpid() ); data/udevil-0.4.4/src/canonicalize.c:40: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 link_path[PATH_MAX+1]; data/udevil-0.4.4/src/canonicalize.c:120: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(newbuf, link_path, n); data/udevil-0.4.4/src/canonicalize.c:121: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(newbuf + n, path, m + 1); data/udevil-0.4.4/src/canonicalize.c:152: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[256], name[256], *res = NULL; data/udevil-0.4.4/src/canonicalize.c:155: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(path, "r"))) data/udevil-0.4.4/src/canonicalize.c:171: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 canonical[PATH_MAX+2]; data/udevil-0.4.4/src/device-info.c:184: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 link_path[PATH_MAX]; data/udevil-0.4.4/src/device-info.c:185: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 resolved_path[PATH_MAX]; data/udevil-0.4.4/src/device-info.c:225:16: [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( value ) != 0; data/udevil-0.4.4/src/device-info.c:609: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). drive_is_ejectable = atoi( value ) != 0; data/udevil-0.4.4/src/device-info.c:689: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). drive_can_detach = atoi( value ) != 0; data/udevil-0.4.4/src/device-info.c:733:26: [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). partition_type = atoi( value ); data/udevil-0.4.4/src/device-info.c:778:21: [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). is_cd = atoi( value ) != 0; data/udevil-0.4.4/src/device-info.c:783:25: [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). is_floppy = atoi( value ) != 0; data/udevil-0.4.4/src/device-info.c:792:18: [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->devnode, O_RDONLY ); data/udevil-0.4.4/src/device-info.c:800: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). media_available = ( atoi( value ) == 1 ); data/udevil-0.4.4/src/device-info.c:803:29: [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). media_available = ( atoi( value ) == 1 ); data/udevil-0.4.4/src/device-info.c:859: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). guint dmajor = atoi( device->major ); data/udevil-0.4.4/src/device-info.c:860: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). guint dminor = atoi( device->minor ); data/udevil-0.4.4/src/device-info.c:1001:56: [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). && atoi( value ) == 1 ) data/udevil-0.4.4/src/device-info.c:1099:75: [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 (slave_sysfs_path != NULL && scheme != NULL && number != NULL && atoi( number ) > 0) data/udevil-0.4.4/src/device-info.c:1179:27: [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 ( optical_state && atoi( optical_state ) != 0 ) data/udevil-0.4.4/src/udevil.c:475: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 *spc_restricted_environ[ ] = { data/udevil-0.4.4/src/udevil.c:481: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 *spc_preserve_environ[ ] = { data/udevil-0.4.4/src/udevil.c:520:5: [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(ptr, var, len + 1); data/udevil-0.4.4/src/udevil.c:527:5: [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(ptr, var, len); data/udevil-0.4.4/src/udevil.c:530:5: [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(ptr + len + 1, value, strlen(value) + 1); data/udevil-0.4.4/src/udevil.c:538:7: [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(ptr, var, len); data/udevil-0.4.4/src/udevil.c:541:7: [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(ptr + len + 1, value, strlen(value) + 1); data/udevil-0.4.4/src/udevil.c:782: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 line[ 2048 ]; data/udevil-0.4.4/src/udevil.c:794: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( conf_path, "r" ); data/udevil-0.4.4/src/udevil.c:799:16: [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( conf_path, "r" ); data/udevil-0.4.4/src/udevil.c:978:21: [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 ( file = fopen( log_lock_file, "w" ) ) data/udevil-0.4.4/src/udevil.c:988: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 hex[9]; data/udevil-0.4.4/src/udevil.c:992: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(hex, "%08x", n); data/udevil-0.4.4/src/udevil.c:999: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 line[ 1024 ]; data/udevil-0.4.4/src/udevil.c:1001:18: [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 ( ( inF = open( src, O_RDONLY ) ) == -1 ) data/udevil-0.4.4/src/udevil.c:1005:18: [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 ( ( ouF = open( dest, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR ) ) == -1 ) data/udevil-0.4.4/src/udevil.c:1029: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 line[LINE_MAX]; data/udevil-0.4.4/src/udevil.c:1059:21: [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 ( file = fopen( str, "w" ) ) data/udevil-0.4.4/src/udevil.c:1067: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( logfile, "r" ); data/udevil-0.4.4/src/udevil.c:1100:32: [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_new = fopen( path_new, "w" ); data/udevil-0.4.4/src/udevil.c:1141:22: [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). guint days = atoi( daystr ); data/udevil-0.4.4/src/udevil.c:1148:18: [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* file = fopen( logfile, "a" ); data/udevil-0.4.4/src/udevil.c:1152:16: [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( logfile, "a" ); data/udevil-0.4.4/src/udevil.c:1406: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 ipstr[INET6_ADDRSTRLEN]; data/udevil-0.4.4/src/udevil.c:1968: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). f = fopen( path, "w" ); data/udevil-0.4.4/src/udevil.c:3520:22: [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( data->device_file, O_RDONLY ); data/udevil-0.4.4/src/udevil.c:4189: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* file = fopen( str, "w" ); data/udevil-0.4.4/src/udevil.c:5101: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 datestring[256]; data/udevil-0.4.4/src/canonicalize.c:50:12: [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). npath += strlen(npath); data/udevil-0.4.4/src/canonicalize.c:116: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). m = strlen(path); data/udevil-0.4.4/src/canonicalize.c:159:44: [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 (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) { data/udevil-0.4.4/src/device-info.c:904:11: [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 (strlen (lines[n]) == 0) data/udevil-0.4.4/src/device-info.c:1139:16: [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). for (n = strlen (s) - 1; n >= 0 && g_ascii_isdigit (s[n]); n--) data/udevil-0.4.4/src/device-info.c:1439:33: [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). strlen (device->drive_connection_interface) == 0 ) data/udevil-0.4.4/src/udevil.c:179:14: [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 ( strlen( lines[n] ) == 0 ) data/udevil-0.4.4/src/udevil.c:496: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). new_size += strlen(var) + 1; data/udevil-0.4.4/src/udevil.c:501: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). new_size += strlen(var) + strlen(value) + 2; /* include the '=' */ data/udevil-0.4.4/src/udevil.c:501:31: [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). new_size += strlen(var) + strlen(value) + 2; /* include the '=' */ data/udevil-0.4.4/src/udevil.c:507: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). new_size += strlen(var) + strlen(value) + 2; /* include the '=' */ data/udevil-0.4.4/src/udevil.c:507:33: [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). new_size += strlen(var) + strlen(value) + 2; /* include the '=' */ data/udevil-0.4.4/src/udevil.c:519:11: [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). len = strlen(var); data/udevil-0.4.4/src/udevil.c:526:11: [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). len = strlen(var); data/udevil-0.4.4/src/udevil.c:530:34: [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). memcpy(ptr + len + 1, value, strlen(value) + 1); data/udevil-0.4.4/src/udevil.c:531:18: [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). ptr += len + strlen(value) + 2; /* include the '=' */ data/udevil-0.4.4/src/udevil.c:537: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). len = strlen(var); data/udevil-0.4.4/src/udevil.c:541:36: [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). memcpy(ptr + len + 1, value, strlen(value) + 1); data/udevil-0.4.4/src/udevil.c:542:20: [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). ptr += len + strlen(value) + 2; /* include the '=' */ data/udevil-0.4.4/src/udevil.c:713: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). cur = s + strlen( str ); data/udevil-0.4.4/src/udevil.c:751:11: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. char* equal; data/udevil-0.4.4/src/udevil.c:753:15: [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). int len = strlen( var ); data/udevil-0.4.4/src/udevil.c:759:15: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( !equal || line == equal || equal - line != len ) data/udevil-0.4.4/src/udevil.c:759:32: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if ( !equal || line == equal || equal - line != len ) data/udevil-0.4.4/src/udevil.c:785:11: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. char* equal; data/udevil-0.4.4/src/udevil.c:828:13: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. equal[0] = '\0'; data/udevil-0.4.4/src/udevil.c:831:13: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. equal[0] = '='; data/udevil-0.4.4/src/udevil.c:1010:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( ( bytes = read( inF, line, sizeof( line ) ) ) > 0 ) data/udevil-0.4.4/src/udevil.c:1216: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). selement[strlen( selement ) - 2] = '\0'; data/udevil-0.4.4/src/udevil.c:1724:31: [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 ( ret[ strlen( ret ) - 1 ] == ')' ) data/udevil-0.4.4/src/udevil.c:1725:30: [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). ret[ strlen( ret ) - 1 ] = '\0'; data/udevil-0.4.4/src/udevil.c:1901:14: [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 ( strlen( lines[n] ) == 0 ) data/udevil-0.4.4/src/udevil.c:1975:33: [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). expected = sizeof( char ) * strlen( data ); data/udevil-0.4.4/src/udevil.c:1976:44: [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). actual = fwrite( data, sizeof( char ), strlen( data ), f ); data/udevil-0.4.4/src/udevil.c:2746: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). tmphost[strlen( tmphost ) - 1] = '\0'; data/udevil-0.4.4/src/udevil.c:2855:32: [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). data->device_file[ strlen( data->device_file ) - 1] = '\0'; data/udevil-0.4.4/src/udevil.c:3336: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). data->point[ strlen( data->point ) - 1] = '\0'; data/udevil-0.4.4/src/udevil.c:4100:37: [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). parent_dir[ strlen( parent_dir ) - 1] = '\0'; data/udevil-0.4.4/src/udevil.c:4109:44: [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). || strlen( parent_dir ) > 30 ) data/udevil-0.4.4/src/udevil.c:4455:23: [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). for ( n = strlen( host_path ) - 1; n >= 0 && host_path[n] != '/'; n-- ) data/udevil-0.4.4/src/udevil.c:5133:11: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. char* equal; ANALYSIS SUMMARY: Hits = 118 Lines analyzed = 7251 in approximately 0.18 seconds (39524 lines/second) Physical Source Lines of Code (SLOC) = 6018 Hits@level = [0] 94 [1] 41 [2] 50 [3] 6 [4] 12 [5] 9 Hits@level+ = [0+] 212 [1+] 118 [2+] 77 [3+] 27 [4+] 21 [5+] 9 Hits/KSLOC@level+ = [0+] 35.2277 [1+] 19.6078 [2+] 12.7949 [3+] 4.48654 [4+] 3.48953 [5+] 1.49551 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.