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/worklog-2.1/worklog.c Examining data/worklog-2.1/worklog.h FINAL RESULTS: data/worklog-2.1/worklog.c:37:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(specific_timefile,"%s.%c",log_filename,project->key); data/worklog-2.1/worklog.c:57:19: [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. if(2==sscanf(line,"%*[^[][%lf %s :",&partial, timetype)) data/worklog-2.1/worklog.c:133:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(project->name,"%s",names); data/worklog-2.1/worklog.c:165:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temps,"Worklog version %s",VERSIONS); data/worklog-2.1/worklog.c:308: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(temps,temps2); data/worklog-2.1/worklog.c:384:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temps,"%s",asctime(localtime(&t))); data/worklog-2.1/worklog.c:581:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(specific_timefile,"%s.%c",log_filename,key); data/worklog-2.1/worklog.c:626:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temps,"%s",asctime(localtime(&t))); data/worklog-2.1/worklog.c:715:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(starttimes,"%s",asctime(localtime(&t))); data/worklog-2.1/worklog.c:682:23: [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. if((default_dir=getenv(DEFAULT_DIR_ENVVAR))) data/worklog-2.1/worklog.c:31: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 specific_timefile[STRLEN]; data/worklog-2.1/worklog.c:32: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 line[STRLEN]; data/worklog-2.1/worklog.c:34: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 timetype[STRLEN]; data/worklog-2.1/worklog.c:38:6: [2] (misc) fopen: 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). fa=fopen(specific_timefile,"r"); data/worklog-2.1/worklog.c:41:10: [2] (misc) fopen: 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). fa=fopen(specific_timefile,"w"); data/worklog-2.1/worklog.c:84: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 names[STRLEN]; data/worklog-2.1/worklog.c:98:5: [2] (misc) fopen: 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). f=fopen(filename,"r"); data/worklog-2.1/worklog.c:176: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(temps," %c",project->key); data/worklog-2.1/worklog.c:279: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(temps,"%0.2f seconds",seconds); data/worklog-2.1/worklog.c:284: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(temps,"%0.2f minutes",minutes); data/worklog-2.1/worklog.c:288:8: [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(temps,"%0.2f hours",hours); data/worklog-2.1/worklog.c:296: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(temps2," (total %0.2f seconds)",seconds); data/worklog-2.1/worklog.c:301: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(temps2," (total %0.2f minutes)",minutes); data/worklog-2.1/worklog.c:305:5: [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(temps2," (total %0.2f hours)",hours); data/worklog-2.1/worklog.c:354:5: [2] (misc) fopen: 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). f=fopen(log_filename,"a"); data/worklog-2.1/worklog.c:369: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(temps,"%0.2f seconds",seconds); data/worklog-2.1/worklog.c:374:8: [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(temps,"%0.2f minutes",minutes); data/worklog-2.1/worklog.c:378: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(temps,"%0.2f hours",hours); data/worklog-2.1/worklog.c:408: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 comments[STRLEN]; data/worklog-2.1/worklog.c:409: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 specific_timefile[STRLEN]; data/worklog-2.1/worklog.c:582:6: [2] (misc) fopen: 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). f=fopen(log_filename,"a"); data/worklog-2.1/worklog.c:589:7: [2] (misc) fopen: 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). fa=fopen(specific_timefile,"a"); data/worklog-2.1/worklog.c:600: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(temps,"%8.2f hours : ",hours); data/worklog-2.1/worklog.c:611: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(temps,"%0.2f seconds",seconds); data/worklog-2.1/worklog.c:616:7: [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(temps,"%0.2f minutes",minutes); data/worklog-2.1/worklog.c:620:9: [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(temps,"%0.2f hours",hours); data/worklog-2.1/worklog.c:706:6: [2] (misc) fopen: 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). lf=fopen(log_filename,"a"); data/worklog-2.1/worklog.h:25: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 temps[STRLEN]; data/worklog-2.1/worklog.h:26: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 temps2[STRLEN]; data/worklog-2.1/worklog.h:27: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 starttimes[STRLEN]; data/worklog-2.1/worklog.c:132:39: [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). project->name=(char *)malloc(1+strlen(names)); data/worklog-2.1/worklog.c:385: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(temps[strlen(temps)-1]<14) data/worklog-2.1/worklog.c:386: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). temps[strlen(temps)-1]=0; data/worklog-2.1/worklog.c:441: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). j=strlen(project->name)+10; data/worklog-2.1/worklog.c:457:35: [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. for(keypress=ERR;keypress==ERR;usleep(100000)) data/worklog-2.1/worklog.c:602:7: [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(comments)>0) data/worklog-2.1/worklog.c:627:13: [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(temps[strlen(temps)-1]<14) data/worklog-2.1/worklog.c:628: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). temps[strlen(temps)-1]=0; data/worklog-2.1/worklog.c:716: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). if(starttimes[strlen(starttimes)-1]<14) data/worklog-2.1/worklog.c:717:16: [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). starttimes[strlen(starttimes)-1]=0; ANALYSIS SUMMARY: Hits = 50 Lines analyzed = 804 in approximately 0.04 seconds (20454 lines/second) Physical Source Lines of Code (SLOC) = 712 Hits@level = [0] 33 [1] 10 [2] 30 [3] 1 [4] 9 [5] 0 Hits@level+ = [0+] 83 [1+] 50 [2+] 40 [3+] 10 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 116.573 [1+] 70.2247 [2+] 56.1798 [3+] 14.0449 [4+] 12.6404 [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.