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/libsdl2-net-2.0.1+dfsg1/SDLnetTCP.c Examining data/libsdl2-net-2.0.1+dfsg1/chatd.c Examining data/libsdl2-net-2.0.1+dfsg1/SDL_net.h Examining data/libsdl2-net-2.0.1+dfsg1/SDLnetUDP.c Examining data/libsdl2-net-2.0.1+dfsg1/SDLnetselect.c Examining data/libsdl2-net-2.0.1+dfsg1/chat.h Examining data/libsdl2-net-2.0.1+dfsg1/chat.cpp Examining data/libsdl2-net-2.0.1+dfsg1/showinterfaces.c Examining data/libsdl2-net-2.0.1+dfsg1/SDLnet.c Examining data/libsdl2-net-2.0.1+dfsg1/SDLnetsys.h FINAL RESULTS: data/libsdl2-net-2.0.1+dfsg1/SDLnetUDP.c:28:9: [3] (random) srandom: 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. #define srandom srand data/libsdl2-net-2.0.1+dfsg1/SDLnetUDP.c:28:17: [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. #define srandom srand data/libsdl2-net-2.0.1+dfsg1/SDLnetUDP.c:29:9: [3] (random) random: 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. #define random rand data/libsdl2-net-2.0.1+dfsg1/SDLnetUDP.c:226:5: [3] (random) srandom: 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. srandom(time(NULL)); data/libsdl2-net-2.0.1+dfsg1/SDLnetUDP.c:347:18: [3] (random) random: 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. if ((random()%100) <= sock->packetloss) { data/libsdl2-net-2.0.1+dfsg1/chat.cpp:80: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. ((name=getenv("CHAT_USER")) == NULL) && data/libsdl2-net-2.0.1+dfsg1/chat.cpp:81: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. ((name=getenv("USER")) == NULL ) ) { data/libsdl2-net-2.0.1+dfsg1/SDLnet.c:63: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 errorbuf[1024]; data/libsdl2-net-2.0.1+dfsg1/SDLnet.c:197: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 data[4096]; data/libsdl2-net-2.0.1+dfsg1/chat.cpp:61: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 *image_files[NUM_IMAGES] = { data/libsdl2-net-2.0.1+dfsg1/chat.cpp:70: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 hello[1+1+256]; data/libsdl2-net-2.0.1+dfsg1/chat.cpp:89: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(&hello[CHAT_HELLO_PORT], &myip->port, 2); data/libsdl2-net-2.0.1+dfsg1/chat.cpp:119: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(packets[0]->data, buf, len); data/libsdl2-net-2.0.1+dfsg1/chat.cpp:127:12: [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 keybuf[80-sizeof(CHAT_PROMPT)+1]; data/libsdl2-net-2.0.1+dfsg1/chat.cpp:187: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(people[which].name, &data[CHAT_ADD_NAME], 256); data/libsdl2-net-2.0.1+dfsg1/chat.cpp:279:31: [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. termwin->AddText((char *)packets[n]->data, packets[n]->len); data/libsdl2-net-2.0.1+dfsg1/chatd.c:103: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 data[512]; data/libsdl2-net-2.0.1+dfsg1/chatd.c:106:17: [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. n = strlen((char *)people[about].name)+1; data/libsdl2-net-2.0.1+dfsg1/chatd.c:109: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(&data[CHAT_ADD_HOST], &people[about].peer.host, 4); data/libsdl2-net-2.0.1+dfsg1/chatd.c:110: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(&data[CHAT_ADD_PORT], &people[about].peer.port, 2); data/libsdl2-net-2.0.1+dfsg1/chatd.c:112: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(&data[CHAT_ADD_NAME], people[about].name, n); data/libsdl2-net-2.0.1+dfsg1/chatd.c:118: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 data[512]; data/libsdl2-net-2.0.1+dfsg1/chatd.c:145:17: [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(&people[which].peer.port, data/libsdl2-net-2.0.1+dfsg1/chatd.c:147:17: [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(people[which].name, data/libsdl2-net-2.0.1+dfsg1/chat.cpp:90: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(name) > 255 ) { data/libsdl2-net-2.0.1+dfsg1/chat.cpp:93: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). n = strlen(name); data/libsdl2-net-2.0.1+dfsg1/chat.cpp:96:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&hello[CHAT_HELLO_NAME], name, n); data/libsdl2-net-2.0.1+dfsg1/chatd.c:106:9: [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). n = strlen((char *)people[about].name)+1; ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 2650 in approximately 0.08 seconds (33216 lines/second) Physical Source Lines of Code (SLOC) = 1664 Hits@level = [0] 20 [1] 4 [2] 17 [3] 7 [4] 0 [5] 0 Hits@level+ = [0+] 48 [1+] 28 [2+] 24 [3+] 7 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 28.8462 [1+] 16.8269 [2+] 14.4231 [3+] 4.20673 [4+] 0 [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.