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/jcal-0.4.1/libjalali/jalali.c Examining data/jcal-0.4.1/libjalali/jtime.h Examining data/jcal-0.4.1/libjalali/jalali.h Examining data/jcal-0.4.1/libjalali/jtime.c Examining data/jcal-0.4.1/libjalali/jconfig.h Examining data/jcal-0.4.1/src/jcal.c Examining data/jcal-0.4.1/src/jcal.h Examining data/jcal-0.4.1/src/jdate.h Examining data/jcal-0.4.1/src/termcap.h Examining data/jcal-0.4.1/src/jdate.c FINAL RESULTS: data/jcal-0.4.1/libjalali/jtime.c:918:4: [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(buf, pad), i++); data/jcal-0.4.1/src/jcal.c:160:6: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf((l->julian) ? " " : " "); data/jcal-0.4.1/src/jcal.c:200:6: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf((l->julian) ? " " : " "); data/jcal-0.4.1/src/jdate.c:235:13: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (action.access) { data/jcal-0.4.1/src/jdate.h:116:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. int access; /* last access */ data/jcal-0.4.1/src/jcal.c:585:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, JCAL_VALID_ARGS)) != -1) { data/jcal-0.4.1/src/jdate.c:99:16: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt_long(argc, argv, JDATE_VALID_ARGS, data/jcal-0.4.1/libjalali/jtime.c:65: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 in_buf[MAX_BUF_SIZE] = {0}; data/jcal-0.4.1/libjalali/jtime.c:89: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(in_buf, buf, MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:140: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(result, &c_jtm, sizeof(struct jtm)); data/jcal-0.4.1/libjalali/jtime.c:143:2: [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(&in_jtm, &c_jtm, sizeof(struct jtm)); data/jcal-0.4.1/libjalali/jtime.c:188: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(result, &c_jtm, sizeof(struct jtm)); data/jcal-0.4.1/libjalali/jtime.c:191:2: [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(&in_jtm, &c_jtm, sizeof(struct jtm)); data/jcal-0.4.1/libjalali/jtime.c:250: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 _l1[10]; data/jcal-0.4.1/libjalali/jtime.c:251: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 _l2[10]; data/jcal-0.4.1/libjalali/jtime.c:252: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 _l3[10]; data/jcal-0.4.1/libjalali/jtime.c:253: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 _la[100]; data/jcal-0.4.1/libjalali/jtime.c:254: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 _lb[100]; data/jcal-0.4.1/libjalali/jtime.c:255: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 buf[MAX_BUF_SIZE]; data/jcal-0.4.1/libjalali/jtime.c:534: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(&t_j, jtm, sizeof(struct jtm)); data/jcal-0.4.1/libjalali/jtime.c:646: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 buf[MAX_BUF_SIZE]; data/jcal-0.4.1/libjalali/jtime.c:647: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 delim[MAX_BUF_SIZE]; data/jcal-0.4.1/libjalali/jtime.c:704:4: [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(delim, pos_c, diff); data/jcal-0.4.1/libjalali/jtime.c:717: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(buf, &s[i], diff1); data/jcal-0.4.1/libjalali/jtime.c:760:19: [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). jtm->tm_mday = atoi(buf); data/jcal-0.4.1/libjalali/jtime.c:768:19: [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). jtm->tm_hour = atoi(buf); data/jcal-0.4.1/libjalali/jtime.c:773:19: [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). jtm->tm_yday = atoi(buf) - 1; data/jcal-0.4.1/libjalali/jtime.c:778:18: [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). jtm->tm_mon = atoi(buf) -1; data/jcal-0.4.1/libjalali/jtime.c:783:18: [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). jtm->tm_min = atoi(buf); data/jcal-0.4.1/libjalali/jtime.c:788:17: [2] (integer) atol: 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). t = (time_t) atol(buf); data/jcal-0.4.1/libjalali/jtime.c:790:4: [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(jtm, &_j, sizeof(struct jtm)); data/jcal-0.4.1/libjalali/jtime.c:795:18: [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). jtm->tm_sec = atoi(buf); data/jcal-0.4.1/libjalali/jtime.c:803:10: [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 = atoi(buf); data/jcal-0.4.1/libjalali/jtime.c:812:19: [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). jtm->tm_year = atoi(buf); data/jcal-0.4.1/libjalali/jtime.c:895: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 _buf[100] = {0}; data/jcal-0.4.1/src/jcal.c:77:2: [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(&mb, ct, sizeof(struct jtm)); data/jcal-0.4.1/src/jcal.c:150: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 buf[100]; data/jcal-0.4.1/src/jcal.c:303: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 cal_t[3][MAX_BUF_SIZE]; data/jcal-0.4.1/src/jcal.c:304: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 cal_y[3][100]; data/jcal-0.4.1/src/jcal.c:306: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 buf[100]; data/jcal-0.4.1/src/jcal.c:419:2: [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(_j[1], j, sizeof(struct jtm)); data/jcal-0.4.1/src/jcal.c:453:2: [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(_j[0], j, sizeof(struct jtm)); data/jcal-0.4.1/src/jcal.c:471: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 title[100]; data/jcal-0.4.1/src/jcal.c:472: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 buf[100]; data/jcal-0.4.1/src/jcal.c:555:9: [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). opt = atoi(argv[i]); data/jcal-0.4.1/src/jdate.c:68: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 buf[MAX_BUF_SIZE]; data/jcal-0.4.1/src/jdate.c:69: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 date_format[MAX_BUF_SIZE]; data/jcal-0.4.1/src/jdate.c:70: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 date_string[MAX_BUF_SIZE]; data/jcal-0.4.1/libjalali/jtime.c:257: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). int fmt_n = strlen(format); data/jcal-0.4.1/libjalali/jtime.c:274:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, jalali_days_3[jtm->tm_wday], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:279:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, jalali_days[jtm->tm_wday], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:284:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, jalali_months_3[jtm->tm_mon], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:289:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, jalali_months[jtm->tm_mon], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:359:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, fa_jalali_days_3[jtm->tm_wday], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:364:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, fa_jalali_days[jtm->tm_wday], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:369:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, fa_jalali_months_3[jtm->tm_mon], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:374:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, fa_jalali_months[jtm->tm_mon], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:379:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, jalali_days_3_fa[jtm->tm_wday], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:384:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, jalali_days_fa[jtm->tm_wday], MAX_BUF_SIZE); data/jcal-0.4.1/libjalali/jtime.c:622: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). b_n = strlen(buf); data/jcal-0.4.1/libjalali/jtime.c:663: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). s_s = strlen(s); data/jcal-0.4.1/libjalali/jtime.c:664: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). fmt_s = strlen(format); data/jcal-0.4.1/src/jcal.c:339:29: [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). cal_tw[i] = (cal_width - (strlen(cal_t[i]) / cw)) / 2; data/jcal-0.4.1/src/jcal.c:351:6: [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). (strlen(cal_t[i]) / cw + ((cw > 1) ? 1 : 0))); data/jcal-0.4.1/src/jcal.c:491: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). cal_tw = (cal_width - strlen(title)) / 2; data/jcal-0.4.1/src/jdate.c:225: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). ds = strlen(ptr); data/jcal-0.4.1/src/jdate.c:227:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(date_format, action.date_ptr, (size_t) (ptr - action.date_ptr)); data/jcal-0.4.1/src/jdate.c:228:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(date_string, ptr+1, ds); ANALYSIS SUMMARY: Hits = 68 Lines analyzed = 2752 in approximately 0.14 seconds (20269 lines/second) Physical Source Lines of Code (SLOC) = 1708 Hits@level = [0] 92 [1] 20 [2] 41 [3] 2 [4] 5 [5] 0 Hits@level+ = [0+] 160 [1+] 68 [2+] 48 [3+] 7 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 93.6768 [1+] 39.8126 [2+] 28.103 [3+] 4.09836 [4+] 2.9274 [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.