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/hannah-1.0/Level.cc Examining data/hannah-1.0/Defines.h Examining data/hannah-1.0/Level.h Examining data/hannah-1.0/pacman.cc Examining data/hannah-1.0/Animation.cc Examining data/hannah-1.0/Animation.h Examining data/hannah-1.0/AnimationFactory.cc Examining data/hannah-1.0/AnimationFactory.h Examining data/hannah-1.0/Bonus.cc Examining data/hannah-1.0/Bonus.h Examining data/hannah-1.0/Food.cc Examining data/hannah-1.0/Food.h Examining data/hannah-1.0/Ghost.cc Examining data/hannah-1.0/Ghost.h Examining data/hannah-1.0/Ghost1.cc Examining data/hannah-1.0/Ghost1.h Examining data/hannah-1.0/Ghost2.cc Examining data/hannah-1.0/Ghost2.h Examining data/hannah-1.0/Ghost3.cc Examining data/hannah-1.0/Ghost3.h Examining data/hannah-1.0/Player.cc Examining data/hannah-1.0/Player.h Examining data/hannah-1.0/Sprite.cc Examining data/hannah-1.0/Sprite.h FINAL RESULTS: data/hannah-1.0/pacman.cc:175:3: [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. sscanf(buffer,"%s %s",nscore,nname); data/hannah-1.0/pacman.cc:179: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(tmp.name,nname); data/hannah-1.0/pacman.cc:522:3: [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. sscanf(pinkline.c_str(),"%*s %s %s",tempx,tempy); data/hannah-1.0/pacman.cc:535:3: [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. sscanf(blueline.c_str(),"%*s %s %s",tempx,tempy); data/hannah-1.0/pacman.cc:547:3: [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. sscanf(redline.c_str(),"%*s %s %s",tempx,tempy); data/hannah-1.0/pacman.cc:562:4: [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. sscanf(foodline.c_str(),"%*s %s %s %s",tempx,tempy,spd); data/hannah-1.0/pacman.cc:668:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tt, "%s", text); data/hannah-1.0/pacman.cc:678:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tt, "%s", text); data/hannah-1.0/pacman.cc:709:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%d %s",tmp.score,tmp.name); data/hannah-1.0/pacman.cc:741:38: [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). case SDLK_RETURN: done = true; strcpy(hiscore[entryAt].name,tt); break; data/hannah-1.0/pacman.cc:1493:2: [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(time(0)); data/hannah-1.0/Animation.cc:30: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 buffer[30]; data/hannah-1.0/Animation.cc:37:15: [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). numframes = atoi(buffer); data/hannah-1.0/Defines.h:29: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 name[15]; data/hannah-1.0/pacman.cc:124: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 name[40]; data/hannah-1.0/pacman.cc:169: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 buffer[40]; data/hannah-1.0/pacman.cc:173: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 nname[40]; data/hannah-1.0/pacman.cc:174: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 nscore[40]; data/hannah-1.0/pacman.cc:178:15: [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). tmp.score = atoi(nscore); data/hannah-1.0/pacman.cc:200:4: [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(news.name,"god"); data/hannah-1.0/pacman.cc:489: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 buffer[SIZEX+1]; data/hannah-1.0/pacman.cc:512: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 tempx[5]; char tempy[5]; char spd[5]; data/hannah-1.0/pacman.cc:512:18: [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 tempx[5]; char tempy[5]; char spd[5]; data/hannah-1.0/pacman.cc:512:33: [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 tempx[5]; char tempy[5]; char spd[5]; data/hannah-1.0/pacman.cc:523:12: [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). tempxi = atoi(tempx); data/hannah-1.0/pacman.cc:524:12: [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). tempyi = atoi(tempy); data/hannah-1.0/pacman.cc:536:12: [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). tempxi = atoi(tempx); data/hannah-1.0/pacman.cc:537:12: [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). tempyi = atoi(tempy); data/hannah-1.0/pacman.cc:548:12: [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). tempxi = atoi(tempx); data/hannah-1.0/pacman.cc:549:12: [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). tempyi = atoi(tempy); data/hannah-1.0/pacman.cc:563:13: [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). tempxi = atoi(tempx); data/hannah-1.0/pacman.cc:564:13: [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). tempyi = atoi(tempy); data/hannah-1.0/pacman.cc:565:15: [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). tempspdi = atoi(spd); data/hannah-1.0/pacman.cc:667: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 tt[40]; data/hannah-1.0/pacman.cc:677: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 tt[40]; data/hannah-1.0/pacman.cc:706: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[40]; data/hannah-1.0/pacman.cc:730: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 tt[9] = "aaa "; data/hannah-1.0/pacman.cc:801:6: [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(tt,"%c%c%c",first[0][c1],first[1][c2],first[2][c3]); data/hannah-1.0/pacman.cc:864: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[30]; data/hannah-1.0/pacman.cc:865:3: [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(buf,"%d",tmp.score); data/hannah-1.0/pacman.cc:890: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 tt[100]; data/hannah-1.0/pacman.cc:892:11: [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. case 1: sprintf(tt, "Level %d - Get Ready!", level); break; data/hannah-1.0/pacman.cc:893:11: [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. case 2: sprintf(tt, "Get Ready!"); break; data/hannah-1.0/pacman.cc:894:11: [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. case 3: sprintf(tt, "Game Over!"); break; data/hannah-1.0/pacman.cc:920: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 tt[40]; data/hannah-1.0/pacman.cc:921:2: [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(tt, "%d", score); data/hannah-1.0/pacman.cc:926:2: [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(tt, "Level %d", level); data/hannah-1.0/pacman.cc:931:2: [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(tt, "Lives %d", lives); data/hannah-1.0/pacman.cc:1462:13: [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). level = atoi(argv[a+1]); ANALYSIS SUMMARY: Hits = 49 Lines analyzed = 3215 in approximately 0.40 seconds (7979 lines/second) Physical Source Lines of Code (SLOC) = 2175 Hits@level = [0] 14 [1] 0 [2] 38 [3] 1 [4] 10 [5] 0 Hits@level+ = [0+] 63 [1+] 49 [2+] 49 [3+] 11 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 28.9655 [1+] 22.5287 [2+] 22.5287 [3+] 5.05747 [4+] 4.5977 [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.