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/open-coarrays-2.9.2/src/libcaf-gfortran-descriptor.h Examining data/open-coarrays-2.9.2/src/libcaf-version-def.h Examining data/open-coarrays-2.9.2/src/tests/performance/psnap/timemeasure.c Examining data/open-coarrays-2.9.2/src/tests/unit/iso-fortran-binding/ISO_Fortran_binding_tests.c Examining data/open-coarrays-2.9.2/src/tests/unit/simple/syncimages2.c Examining data/open-coarrays-2.9.2/src/common/caf_auxiliary.c Examining data/open-coarrays-2.9.2/src/mpi/mpi_caf.c Examining data/open-coarrays-2.9.2/src/iso-fortran-binding/ISO_Fortran_binding.c Examining data/open-coarrays-2.9.2/src/iso-fortran-binding/ISO_Fortran_binding.h Examining data/open-coarrays-2.9.2/src/libcaf.h Examining data/open-coarrays-2.9.2/doc/sample-compiler-output.c FINAL RESULTS: data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:84:1: [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, "%d/%d: %s(%d) " format, \ data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:420:3: [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(stderr, message, ap); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:444:14: [4] (format) snprintf: 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. int len = snprintf (errmsg, errmsg_len, msg, args); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:454:5: [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(stderr, msg, args); data/open-coarrays-2.9.2/src/libcaf.h:183:16: [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 mode[GFC_MAX_DIMENSIONS]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:93: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 err_str[MPI_MAX_ERROR_STRING]; \ data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:247:1: [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 err_buffer[MPI_MAX_ERROR_STRING]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:516: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 errstr[MPI_MAX_ERROR_STRING]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:755: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(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:801: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(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1317: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 msg[80]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1318:5: [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(msg, "Failed to allocate coarray"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1320:7: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(msg, " - there are stopped images"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1329:9: [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(errmsg, msg, len); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1406: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 msg[80]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1407:5: [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(msg, "Failed to allocate coarray"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1409:7: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(msg, " - there are stopped images"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1418:9: [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(errmsg, msg, len); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1456:9: [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(errmsg, msg, len); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1620: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 msg[80]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1621:5: [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(msg, "SYNC ALL failed"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1623:7: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(msg, " - there are stopped images"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1629: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(errmsg, msg, len); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:2520:13: [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((void *)((char *)dst + src_size), pad_str, data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:2837:7: [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 error_str[error_len]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:2838:7: [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(error_str, "MPI-error: "); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:3411:7: [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 error_str[error_len]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:3412:7: [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(error_str, "MPI-error: "); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:3845:13: [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((void *)((char *)dst + src_size), pad_str, data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:3930:7: [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 error_str[error_len + 11]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:3931:7: [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(error_str, "MPI-error: "); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:4015:47: [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. dprint("srh[0] = %d, ierr = %d\n", (int)((char *)srh)[0], ierr); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:6308: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(&temp_src, src, sizeof_desc_for_rank(GFC_DESCRIPTOR_RANK(src))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:6326: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(temp_src.base.base_addr, src->base_addr, cap); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7194: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 msg[80]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7195:5: [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(msg, "SYNC IMAGES failed"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7197:7: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(msg, " - there are stopped images"); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7202: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(errmsg, msg, len); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7504: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(errmsg, err_buffer, (errmsg_len > len) ? len : errmsg_len); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7611: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(errmsg, err_buffer, (errmsg_len > len) ? len : errmsg_len); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7943: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(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:8003: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(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:8152: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 errmsg[60]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:8153: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(errmsg, "Image #%d out of bounds of images 1..%d.", data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:8185:7: [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 errmsg[strcap]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:8187: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. sprintf(errmsg, "Image status for image #%d returned mpi error: ", data/open-coarrays-2.9.2/src/tests/unit/simple/syncimages2.c:67: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 errmsg[255]; data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:740: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(caf_this_image * i); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:755:40: [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(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:801:40: [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(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1327: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). size_t len = (strlen(msg) > (size_t) errmsg_len) ? data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1328: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). (size_t) errmsg_len : strlen (msg); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1416: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). size_t len = (strlen(msg) > (size_t) errmsg_len) ? data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1417: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). (size_t) errmsg_len : strlen (msg); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1627: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). size_t len = (strlen(msg) > (size_t) errmsg_len) ? data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:1628: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). (size_t) errmsg_len : strlen (msg); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7201: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). size_t len = (strlen(msg) > errmsg_len) ? errmsg_len : strlen (msg); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7201:62: [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 len = (strlen(msg) > errmsg_len) ? errmsg_len : strlen (msg); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7545: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). a_length = strlen(a->base_addr); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7943: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). memcpy(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:7977: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(10 * i); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:8003: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). memcpy(errmsg, msg, MIN(errmsg_len,strlen(msg))); data/open-coarrays-2.9.2/src/mpi/mpi_caf.c:8189: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). slen = strlen(errmsg); ANALYSIS SUMMARY: Hits = 63 Lines analyzed = 11871 in approximately 0.37 seconds (32073 lines/second) Physical Source Lines of Code (SLOC) = 9878 Hits@level = [0] 129 [1] 16 [2] 43 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 192 [1+] 63 [2+] 47 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 19.4371 [1+] 6.37781 [2+] 4.75805 [3+] 0.40494 [4+] 0.40494 [5+] 0 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.