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/pqiv-2.12/backends/archive.c Examining data/pqiv-2.12/backends/archive_cbx.c Examining data/pqiv-2.12/backends/gdkpixbuf.c Examining data/pqiv-2.12/backends/libav.c Examining data/pqiv-2.12/backends/poppler.c Examining data/pqiv-2.12/backends/shared-initializer.c Examining data/pqiv-2.12/backends/spectre.c Examining data/pqiv-2.12/backends/wand.c Examining data/pqiv-2.12/backends/webp.c Examining data/pqiv-2.12/lib/bostree.c Examining data/pqiv-2.12/lib/bostree.h Examining data/pqiv-2.12/lib/config_parser.c Examining data/pqiv-2.12/lib/config_parser.h Examining data/pqiv-2.12/lib/filebuffer.c Examining data/pqiv-2.12/lib/filebuffer.h Examining data/pqiv-2.12/lib/strnatcmp.c Examining data/pqiv-2.12/lib/strnatcmp.h Examining data/pqiv-2.12/lib/thumbnailcache.c Examining data/pqiv-2.12/lib/thumbnailcache.h Examining data/pqiv-2.12/pqiv.c Examining data/pqiv-2.12/pqiv.h FINAL RESULTS: data/pqiv-2.12/backends/shared-initializer.c:36:25: [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. ssize_t name_length = readlink("/proc/self/exe", self_name, PATH_MAX); data/pqiv-2.12/lib/bostree.h:151:28: [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. #define bostree_debug(...) fprintf(stderr, __VA_ARGS__) data/pqiv-2.12/lib/config_parser.c:219:2: [4] (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). strcpy(dup, value->chrpval); data/pqiv-2.12/lib/thumbnailcache.c:422:3: [4] (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). strcpy(&output[19], info->Thumb_URI); data/pqiv-2.12/lib/thumbnailcache.c:436:3: [4] (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). strcpy(&output[21], info->Thumb_MTime); data/pqiv-2.12/pqiv.c:3483:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(retval + (ins_pos - command), "%s%s", quoted, ins_pos + 2); data/pqiv-2.12/pqiv.c:3487:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(retval, "%s %s", command, quoted); data/pqiv-2.12/lib/filebuffer.c:203:98: [3] (buffer) g_get_tmp_dir: This function is synonymous with 'getenv("TMP")';it returns untrustable input if the environment can beset by an attacker. It 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. g_printerr("Failed to buffer %s: Could not create a temporary file in %s\n", file->file_name, g_get_tmp_dir()); data/pqiv-2.12/pqiv.c:1644:6: [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. realpath(param, abs_path) != NULL data/pqiv-2.12/pqiv.c:3144:66: [3] (random) g_random_int_range: 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. next_candidate = chosen_candidate = bostree_select(file_tree, g_random_int_range(0, count)); data/pqiv-2.12/pqiv.c:3207:58: [3] (random) g_random_int_range: 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. BOSNode *chosen_candidate = bostree_select(file_tree, g_random_int_range(0, count)); data/pqiv-2.12/pqiv.c:3712:108: [3] (random) g_random_int: 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. store_target = g_strdup_printf("./.pqiv-select/memory-%" G_GINT64_FORMAT "-%u.png", g_get_real_time(), g_random_int()); data/pqiv-2.12/pqiv.c:3714:68: [3] (random) g_random_int: 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. store_target = g_strdup_printf("./.pqiv-select/memory-%u.png", g_random_int()); data/pqiv-2.12/backends/archive.c:166: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(new_file_data->entry_name, entry_name, strlen(entry_name) + 1); data/pqiv-2.12/backends/libav.c:100: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(buf, (const char*)data + private->file_data_pos, buf_size); data/pqiv-2.12/backends/wand.c:76: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(data, *pos, length); data/pqiv-2.12/backends/webp.c:128: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(&pixel, &surface_data[i*surface_stride+j*4], sizeof(uint32_t)); data/pqiv-2.12/backends/webp.c:141: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(&surface_data[i*surface_stride+j*4], &pixel, sizeof(uint32_t)); data/pqiv-2.12/lib/config_parser.c:53: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). int fd = open(file_name, O_RDONLY); data/pqiv-2.12/lib/config_parser.c:113:18: [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). value.intval = atoi(value.chrpval); data/pqiv-2.12/lib/config_parser.c:218: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 dup[strlen(value->chrpval)]; data/pqiv-2.12/lib/config_parser.c:247: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(data_copy, data, data_size); data/pqiv-2.12/lib/filebuffer.c:99:14: [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). int fd = open(input_file_abspath, O_RDONLY); data/pqiv-2.12/lib/thumbnailcache.c:155: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[8]; data/pqiv-2.12/lib/thumbnailcache.c:420: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(output, &write_uint32, sizeof(uint32_t)); data/pqiv-2.12/lib/thumbnailcache.c:421:3: [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(&output[4], "tEXtThumb::URI"); data/pqiv-2.12/lib/thumbnailcache.c:424: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(&output[19+uri_length] , &write_uint32, sizeof(uint32_t)); data/pqiv-2.12/lib/thumbnailcache.c:434: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(output, &write_uint32, sizeof(uint32_t)); data/pqiv-2.12/lib/thumbnailcache.c:435:3: [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(&output[4], "tEXtThumb::MTime"); data/pqiv-2.12/lib/thumbnailcache.c:438: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(&output[21+mtime_length], &write_uint32, sizeof(uint32_t)); data/pqiv-2.12/pqiv.c:1639:4: [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 abs_path[PATH_MAX]; data/pqiv-2.12/pqiv.c:3482: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(retval, command, ins_pos - command); data/pqiv-2.12/pqiv.c:3947: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). ssize_t desired_index = atoi(&entry_text[1]); data/pqiv-2.12/pqiv.c:6415:14: [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. unsigned char key_sequence[binding_length+1]; data/pqiv-2.12/pqiv.c:7623: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(identifier, token_start, identifier_length); data/pqiv-2.12/pqiv.c:7658: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(identifier, token_start, identifier_length); data/pqiv-2.12/pqiv.c:7730:34: [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). binding->parameter.pint = atoi(identifier); data/pqiv-2.12/pqiv.c:7745:50: [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). binding->parameter.p2short.p1 = (short)atoi(identifier); data/pqiv-2.12/pqiv.c:7746:50: [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). binding->parameter.p2short.p2 = (short)atoi(comma_pos); data/pqiv-2.12/pqiv.c:7908: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). parsed_parameter.pint = atoi(parameter); data/pqiv-2.12/pqiv.c:7926:46: [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). parsed_parameter.p2short.p1 = (short)atoi(parameter); data/pqiv-2.12/pqiv.c:7927:46: [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). parsed_parameter.p2short.p2 = (short)atoi(comma_pos); data/pqiv-2.12/backends/archive.c:162:80: [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). size_t delegate_struct_alloc_size = sizeof(file_loader_delegate_archive_t) + strlen(entry_name) + 2; data/pqiv-2.12/backends/archive.c:166:49: [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(new_file_data->entry_name, entry_name, strlen(entry_name) + 1); data/pqiv-2.12/lib/config_parser.c:39: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). memmove(p, k, strlen(k) + 1); data/pqiv-2.12/lib/config_parser.c:77:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(fd, file_data, stat.st_size) == stat.st_size) { data/pqiv-2.12/lib/config_parser.c:218: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). char dup[strlen(value->chrpval)]; data/pqiv-2.12/lib/config_parser.c:234:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t red = read(0, &data[len], data_size - len); data/pqiv-2.12/lib/thumbnailcache.c:115: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). int filename_basename_length = strlen(filename_basename); data/pqiv-2.12/lib/thumbnailcache.c:116: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). int display_basename_length = strlen(display_basename); data/pqiv-2.12/lib/thumbnailcache.c:160:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(fd, header.buf, 8) != 8) { data/pqiv-2.12/lib/thumbnailcache.c:172:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(fd, header.buf, 8) != 8) { data/pqiv-2.12/lib/thumbnailcache.c:188:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(fd, data, header_length) != header_length) { data/pqiv-2.12/lib/thumbnailcache.c:195:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(fd, header.buf, 4) != 4) { data/pqiv-2.12/lib/thumbnailcache.c:205:70: [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). file_uri_match = strncmp(&data[sizeof("Thumb::URI")], file_uri, strlen(file_uri)) == 0; data/pqiv-2.12/lib/thumbnailcache.c:209:80: [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). file_mtime_match = strncmp(&data[sizeof("Thumb::MTime")], file_mtime_str, strlen(file_mtime_str)) == 0; data/pqiv-2.12/lib/thumbnailcache.c:414: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). int uri_length = strlen(info->Thumb_URI); data/pqiv-2.12/lib/thumbnailcache.c:430:22: [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 mtime_length = strlen(info->Thumb_MTime); data/pqiv-2.12/pqiv.c:1104:42: [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). end_of_argument = options_contents + strlen(options_contents); data/pqiv-2.12/pqiv.c:1344: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). size_t original_path_length = strlen(options->recursion_folder_stack->data); data/pqiv-2.12/pqiv.c:1345:54: [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(original_path_length && original_path_length < strlen(name)) { data/pqiv-2.12/pqiv.c:2853:97: [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. while(!image_loader_load_single(current_file_node, TRUE) && bostree_node_count(file_tree) > 0) usleep(10000); data/pqiv-2.12/pqiv.c:3480: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). retval = (gchar*)g_malloc(strlen(command) + strlen(quoted) + 2); data/pqiv-2.12/pqiv.c:3480:48: [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). retval = (gchar*)g_malloc(strlen(command) + strlen(quoted) + 2); data/pqiv-2.12/pqiv.c:3486: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). retval = (gchar*)g_malloc(strlen(command) + 2 + strlen(quoted)); data/pqiv-2.12/pqiv.c:3486:52: [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). retval = (gchar*)g_malloc(strlen(command) + 2 + strlen(quoted)); data/pqiv-2.12/pqiv.c:3518:54: [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). gchar *output_text = g_locale_to_utf8((gchar*)text, strlen((gchar*)text), NULL, &output_text_length, NULL); data/pqiv-2.12/pqiv.c:6370:38: [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). const int number_of_characters = strlen(parameter.pcharptr); data/pqiv-2.12/pqiv.c:7669:22: [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((ptrdiff_t)strlen(descriptor->name) == identifier_length && g_ascii_strncasecmp(descriptor->name, identifier, identifier_length) == 0) { data/pqiv-2.12/pqiv.c:7829:21: [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 print_after = strlen(scan); data/pqiv-2.12/pqiv.c:7882: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((ptrdiff_t)strlen(descriptor->name) == identifier_length && g_ascii_strncasecmp(descriptor->name, action_name_start, identifier_length) == 0) { ANALYSIS SUMMARY: Hits = 71 Lines analyzed = 12970 in approximately 0.32 seconds (40410 lines/second) Physical Source Lines of Code (SLOC) = 9933 Hits@level = [0] 11 [1] 29 [2] 29 [3] 6 [4] 6 [5] 1 Hits@level+ = [0+] 82 [1+] 71 [2+] 42 [3+] 13 [4+] 7 [5+] 1 Hits/KSLOC@level+ = [0+] 8.25531 [1+] 7.14789 [2+] 4.22833 [3+] 1.30877 [4+] 0.704722 [5+] 0.100675 Dot directories skipped = 2 (--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.