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/twclock-3.5/src/twclock.c Examining data/twclock-3.5/src/twclock.h Examining data/twclock-3.5/src/twclockHelp.h Examining data/twclock-3.5/src/libCW.h Examining data/twclock-3.5/src/twclockDiags.c Examining data/twclock-3.5/src/libCW.c Examining data/twclock-3.5/src/twclockWids.c Examining data/twclock-3.5/src/twclockCB.c FINAL RESULTS: data/twclock-3.5/src/libCW.c:425:4: [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 (new_str, str); data/twclock-3.5/src/libCW.c:863:4: [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 (serdevice, ser); data/twclock-3.5/src/twclockCB.c:258:7: [4] (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). strcat (timepath, path); /* and put it in timepath */ data/twclock-3.5/src/libCW.c:77: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 serdevice[MAX_NAME] = ""; /* default serial device path */ data/twclock-3.5/src/libCW.c:78: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 pa_name[MAX_NAME] = ""; /* shows up on pa vol ctrl */ data/twclock-3.5/src/libCW.c:103: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 *codetable[MAX_LETTERS]; data/twclock-3.5/src/libCW.c:402:11: [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 s[MAX_WORD_LENGTH]; data/twclock-3.5/src/libCW.c:423: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 new_str[MAX_WORD_LENGTH + 1]; data/twclock-3.5/src/libCW.c:442: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 str[2]; data/twclock-3.5/src/libCW.c:467:10: [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 word[MAX_WORD_LENGTH]; data/twclock-3.5/src/libCW.c:789:17: [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). if ((fd = open ("/dev/rtc", O_RDONLY)) < 0) data/twclock-3.5/src/libCW.c:927:20: [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). if ((fd = open ("/dev/rtc", O_RDONLY)) < 0) data/twclock-3.5/src/libCW.c:1121: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). if ((fd = open(serdevice, O_RDWR, 0)) < 0) data/twclock-3.5/src/twclockCB.c:39: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 timepath[100]; data/twclock-3.5/src/twclockCB.c:83:10: [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 (timepath, "TZ=GMT"); data/twclock-3.5/src/twclockCB.c:202: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 datestr[40]; data/twclock-3.5/src/twclockCB.c:257: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 (timepath, "TZ="); /* build the new TZ value */ data/twclock-3.5/src/twclockCB.c:434: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 minutes[10], seconds[10]; data/twclock-3.5/src/twclockCB.c:452:4: [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 (minutes, "%d", appRes.minutes); data/twclock-3.5/src/twclockCB.c:453:4: [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 (seconds, "%d", appRes.seconds); data/twclock-3.5/src/twclockCB.c:830: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). min = atoi(minStr); data/twclock-3.5/src/twclockCB.c:831: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). sec = atoi(secStr); data/twclock-3.5/src/libCW.c:162:8: [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 (ser) == 0) data/twclock-3.5/src/libCW.c:169:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (serdevice, ser, MAX_NAME - 1); /* copy ser to serdevice */ data/twclock-3.5/src/libCW.c:174:8: [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) == 0) data/twclock-3.5/src/libCW.c:181:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (pa_name, name, MAX_NAME - 1); /* copy name to pa_name */ data/twclock-3.5/src/libCW.c:427:12: [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 (str[strlen (str)] != ' '); /* if word does not end with a space */ data/twclock-3.5/src/libCW.c:429:7: [1] (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 character. strcat (new_str, " "); data/twclock-3.5/src/libCW.c:473:8: [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 ((char *)p) == 0) /* nothing to send */ data/twclock-3.5/src/libCW.c:618: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). if (strlen (code) > i) /* if more ./- to do */ data/twclock-3.5/src/libCW.c:812:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (fd, &rtc_data, sizeof(rtc_data)) < 0) data/twclock-3.5/src/libCW.c:893:15: [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 (str) == 0) && (strlen (pa_name) == 0)) data/twclock-3.5/src/libCW.c:893: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). if ((strlen (str) == 0) && (strlen (pa_name) == 0)) data/twclock-3.5/src/libCW.c:914:15: [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 (str) == 0) && (strlen (serdevice) == 0)) data/twclock-3.5/src/libCW.c:914: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). if ((strlen (str) == 0) && (strlen (serdevice) == 0)) data/twclock-3.5/src/libCW.c:921: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 (str) != 0) data/twclock-3.5/src/libCW.c:923:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (serdevice, str, MAX_NAME - 1); /* save str as serdevice */ data/twclock-3.5/src/libCW.c:1378:8: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). d = getchar (); data/twclock-3.5/src/twclockCB.c:78:10: [1] (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 character. strcpy (timepath, ""); data/twclock-3.5/src/twclockCB.c:254:10: [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). len = strlen (path); ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 3592 in approximately 0.10 seconds (36663 lines/second) Physical Source Lines of Code (SLOC) = 2221 Hits@level = [0] 44 [1] 18 [2] 19 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 84 [1+] 40 [2+] 22 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 37.8208 [1+] 18.0099 [2+] 9.90545 [3+] 1.35074 [4+] 1.35074 [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.