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/libjna-java-5.5.0/native/callback.c Examining data/libjna-java-5.5.0/native/dispatch.c Examining data/libjna-java-5.5.0/native/dispatch.h Examining data/libjna-java-5.5.0/native/dll-callback.c Examining data/libjna-java-5.5.0/native/protect.h Examining data/libjna-java-5.5.0/native/snprintf.h Examining data/libjna-java-5.5.0/native/testlib.c Examining data/libjna-java-5.5.0/native/testlib2.c FINAL RESULTS: data/libjna-java-5.5.0/native/dispatch.c:301:5: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(prefixed, size, L"\\\\?\\%ls", wstr); data/libjna-java-5.5.0/native/dispatch.c:3093:7: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(path, len, L"%s%s", prop, suffix); data/libjna-java-5.5.0/native/snprintf.h:6:12: [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. static int snprintf(char * str, size_t size, const char * format, ...) { data/libjna-java-5.5.0/native/callback.c:99: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 name[256]; data/libjna-java-5.5.0/native/callback.c:124: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 msg[MSG_SIZE]; data/libjna-java-5.5.0/native/callback.c:394: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(&args[3], cbargs, cif->nargs * sizeof(void *)); data/libjna-java-5.5.0/native/callback.c:496: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(oldresp, getStructureAddress(env, *(void **)resp), cb->cif.rtype->size); data/libjna-java-5.5.0/native/dispatch.c:127: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. PSTART(); memcpy(D,S,L); PEND(ENV); \ data/libjna-java-5.5.0/native/dispatch.c:310: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[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:318: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 buf[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:422: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 msg[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:461: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 msg[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:658: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 emsg[MSG_SIZE - 3 /* literal characters */ - 10 /* max length of %d */]; data/libjna-java-5.5.0/native/dispatch.c:1583: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(buffer, ptr, size); data/libjna-java-5.5.0/native/dispatch.c:1596: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[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:1749: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 msg[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:1904: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 emsg[MSG_SIZE - 3 /* literal characters */ - 10 /* max length of %d */]; data/libjna-java-5.5.0/native/dispatch.c:2244: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 buf[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:2262: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 buf[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:2283: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[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:2806: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 msg[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:3021: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 field[32]; data/libjna-java-5.5.0/native/dispatch.c:3101: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 msg[MSG_SIZE]; data/libjna-java-5.5.0/native/dispatch.c:3106: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 msg[MSG_SIZE], buf[MSG_SIZE - 31 /* literal characters */ - sizeof(METHOD_NAME)]; data/libjna-java-5.5.0/native/dispatch.c:3417: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[MSG_SIZE]; data/libjna-java-5.5.0/native/testlib.c:330: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 buffer[1]; data/libjna-java-5.5.0/native/testlib.c:670: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 name[256]; data/libjna-java-5.5.0/native/dispatch.c:298:19: [1] (buffer) wcslen: 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 size = wcslen(wstr) + 5; data/libjna-java-5.5.0/native/dispatch.c:853: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). int len = (int)strlen((const char*)ptr); data/libjna-java-5.5.0/native/dispatch.c:878:26: [1] (buffer) wcslen: 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). jsize len = (int)wcslen((const wchar_t*)ptr); data/libjna-java-5.5.0/native/dispatch.c:901:24: [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 = (int)strlen((const char*)ptr); data/libjna-java-5.5.0/native/dispatch.c:2633: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 len = (int)strlen(addr); data/libjna-java-5.5.0/native/dispatch.c:3090:20: [1] (buffer) wcslen: 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 = wcslen(prop) + wcslen(suffix) + 1; data/libjna-java-5.5.0/native/dispatch.c:3090:35: [1] (buffer) wcslen: 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 = wcslen(prop) + wcslen(suffix) + 1; data/libjna-java-5.5.0/native/testlib.c:70:19: [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. #define SLEEP(MS) usleep(MS*1000) ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 5908 in approximately 0.31 seconds (18999 lines/second) Physical Source Lines of Code (SLOC) = 4818 Hits@level = [0] 51 [1] 8 [2] 24 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 86 [1+] 35 [2+] 27 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 17.8497 [1+] 7.26443 [2+] 5.60399 [3+] 0.622665 [4+] 0.622665 [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.