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/cwebx-3.52/common.h Examining data/cwebx-3.52/ctangle.c Examining data/cwebx-3.52/common.c FINAL RESULTS: data/cwebx-3.52/common.c:177:22: [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). at_i_path.name=strcpy(byte_ptr,cwebinputs); data/cwebx-3.52/common.c:260:18: [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(name_buf,at_h_path[i].name); data/cwebx-3.52/common.c:261:11: [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(&name_buf[at_h_path[i].length],cur_file_name); data/cwebx-3.52/common.c:265:14: [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(name_buf,at_i_path.name); data/cwebx-3.52/common.c:266:14: [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(&name_buf[at_i_path.length],cur_file_name); data/cwebx-3.52/common.c:387:7: [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(file[0].name,web_file_name); data/cwebx-3.52/common.c:389:7: [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(file[0].name,alt_web_file_name); data/cwebx-3.52/common.c:395:9: [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(change.name,change_file_name); data/cwebx-3.52/common.c:757:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(s,p); va_end(p); err_print(""); data/cwebx-3.52/common.c:783:50: [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). at_h_path[paths_found++].name=strcpy(byte_ptr,p); data/cwebx-3.52/common.c:801:23: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. { if (dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); data/cwebx-3.52/common.c:803:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. { sprintf(web_file_name,"%s",*argv); /* use file name and extension */ data/cwebx-3.52/common.c:806:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(alt_web_file_name,"%s.web",*argv); data/cwebx-3.52/common.c:807:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(change_file_name,"%s.ch",*argv); data/cwebx-3.52/common.c:809:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(C_file_name,"%s.%s",*argv, C_plus_plus ? CPPEXT : "c"); data/cwebx-3.52/common.c:811:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. { sprintf(tex_file_name,"%s.tex",*argv); data/cwebx-3.52/common.c:812:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(idx_file_name,"%s.idx",*argv); data/cwebx-3.52/common.c:813:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(scn_file_name,"%s.scn",*argv); data/cwebx-3.52/common.c:821:24: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(change_file_name,dot_pos==NULL ? "%s.ch" : "%s", *argv); data/cwebx-3.52/common.c:826:43: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (dot_pos!=NULL) sprintf(C_file_name, "%s", *argv); data/cwebx-3.52/common.c:827:29: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf(C_file_name,"%s.%s", *argv, C_plus_plus ? CPPEXT : "c"); data/cwebx-3.52/common.c:830:28: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. { sprintf(tex_file_name, "%s", *argv); *dot_pos='\0'; } data/cwebx-3.52/common.c:831:29: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf(tex_file_name,"%s.tex", *argv); data/cwebx-3.52/common.c:832:24: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(idx_file_name,"%s.idx",*argv); data/cwebx-3.52/common.c:833:24: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(scn_file_name,"%s.scn",*argv); data/cwebx-3.52/common.c:868:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(s,p); va_end(p); /* print formatted value */ data/cwebx-3.52/ctangle.c:94:28: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define C_printf(format,x) fprintf(C_file,format,x) data/cwebx-3.52/common.c:169:22: [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. { char* cwebinputs=getenv("CWEBINPUTS"); data/cwebx-3.52/common.c:88: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 buffer[long_buf_size]; /* where each line of input goes */ data/cwebx-3.52/common.c:95:7: [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. local char web_file_name[max_file_name_length] data/cwebx-3.52/common.c:112:7: [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. local char change_buffer[buf_size]; /* next line of |change_file| */ data/cwebx-3.52/common.c:118: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 byte_mem[max_bytes]; /* characters of names */ data/cwebx-3.52/common.c:130: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 mod_text[longest_name+1]; /* name being sought for */ data/cwebx-3.52/common.c:137: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 C_file_name[max_file_name_length]; /* name of |C_file| */ data/cwebx-3.52/common.c:138:7: [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. local char tex_file_name[max_file_name_length]; /* name of |tex_file| */ data/cwebx-3.52/common.c:139: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 idx_file_name[max_file_name_length]; /* name of index file */ data/cwebx-3.52/common.c:140: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 scn_file_name[max_file_name_length]; /* name of module names file */ data/cwebx-3.52/common.c:252:33: [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). if (non_system && (cur_file=fopen(cur_file_name,"r"))!=NULL) data/cwebx-3.52/common.c:255: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. { char name_buf[max_path_length+max_file_name_length]; int i; data/cwebx-3.52/common.c:262:32: [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). if ((cur_file=fopen(name_buf,"r"))!=NULL) { success=true; break; } data/cwebx-3.52/common.c:267:33: [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). success= (cur_file=fopen(name_buf,"r"))!=NULL; data/cwebx-3.52/common.c:386:19: [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). { if ((web_file=fopen(web_file_name,"r"))!=NULL) data/cwebx-3.52/common.c:388:24: [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). else if ((web_file=fopen(alt_web_file_name,"r"))!=NULL) data/cwebx-3.52/common.c:394:24: [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). if ((change_file=fopen(change_file_name,"r"))!=NULL) data/cwebx-3.52/common.c:860:14: [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). if ((*file=fopen(name,"w"))==NULL) data/cwebx-3.52/common.h:37:15: [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. { FILE *file; char name[max_file_name_length]; sixteen_bits line; } data/cwebx-3.52/ctangle.c:185: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 indent_buffer[max_indent]; data/cwebx-3.52/ctangle.c:195: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 c_trans[UCHAR_MAX+1-0x80][trans_limit+1]; data/cwebx-3.52/ctangle.c:215: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. do sprintf(trans_of(c),"X%X",c); while (--c>=0x80); data/cwebx-3.52/ctangle.c:287:7: [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 output_file_name[longest_name+1]; /* name of the file */ data/cwebx-3.52/ctangle.c:307:26: [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). else if ((C_file=fopen(output_file_name,"w"))==NULL) data/cwebx-3.52/common.c:41:26: [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). #define length(p) ((int)(strlen(name_begin(p)))) data/cwebx-3.52/common.c:154:3: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. equal, /* the first name is equal to the second */ data/cwebx-3.52/common.c:173:30: [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). at_h_path[0].length=(int)strlen(CWEBHEADERS); data/cwebx-3.52/common.c:176: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). { at_i_path.length=(int)strlen(cwebinputs); data/cwebx-3.52/common.c:183:56: [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). at_i_path.name=CWEBINPUTS; at_i_path.length=(int)strlen(CWEBINPUTS); data/cwebx-3.52/common.c:202:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c=getc(f))!='\n' && c!=EOF) data/cwebx-3.52/common.c:336:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(change_buffer,buffer,n); data/cwebx-3.52/common.c:364:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(change_buffer,buffer,n); data/cwebx-3.52/common.c:462:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cur_f->name,loc,i); cur_f->name[i]='\0'; data/cwebx-3.52/common.c:476:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer,change_buffer,l); limit=&buffer[l]; data/cwebx-3.52/common.c:487:41: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). byte_ptr+=l; *byte_ptr++='\0'; return strncpy(dest,s,l); data/cwebx-3.52/common.c:493: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 (last==NULL) last=first+(l=(int)strlen(first)); /* null-terminated string */ data/cwebx-3.52/common.c:518:47: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. return l1<l2 ? prefix : l1>l2 ? extension : equal; data/cwebx-3.52/common.c:539:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. case equal: case extension: data/cwebx-3.52/common.c:542:44: [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). mod_name_cmp(name+l0,l-l0,key+l0,(int)strlen(key+l0)); data/cwebx-3.52/common.c:549:27: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. case extension: case equal: data/cwebx-3.52/common.c:551:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (cmp==equal) return p; data/cwebx-3.52/common.c:587:12: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. case equal: return p; /* a match, and no other matches are possible */ data/cwebx-3.52/common.c:591:44: [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). mod_name_cmp(name+l0,l-l0,key+l0,(int)strlen(key+l0)); data/cwebx-3.52/common.c:598:24: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. case prefix: case equal: return p; data/cwebx-3.52/common.c:609:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(key,name,l); key[l]='\0'; /* store the incomplete name */ data/cwebx-3.52/common.c:629:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(key,name,l); key[l]='\0'; /* store the incomplete name */ data/cwebx-3.52/common.c:773:27: [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). { size_t l=strlen(p); data/cwebx-3.52/common.c:790: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(*argv)+5>max_file_name_length) data/cwebx-3.52/common.c:869:22: [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). term_line_empty= s[strlen(s)-1]=='\n'; update_terminal(); data/cwebx-3.52/ctangle.c:50:26: [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). #define length(p) ((int)(strlen(name_begin(p)))) ANALYSIS SUMMARY: Hits = 77 Lines analyzed = 1923 in approximately 0.13 seconds (14705 lines/second) Physical Source Lines of Code (SLOC) = 1622 Hits@level = [0] 10 [1] 26 [2] 23 [3] 1 [4] 27 [5] 0 Hits@level+ = [0+] 87 [1+] 77 [2+] 51 [3+] 28 [4+] 27 [5+] 0 Hits/KSLOC@level+ = [0+] 53.6375 [1+] 47.4723 [2+] 31.4427 [3+] 17.2626 [4+] 16.6461 [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.