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/uniutils-2.27/nelson.h Examining data/uniutils-2.27/offsettbl.h Examining data/uniutils-2.27/unicode.h Examining data/uniutils-2.27/uniftypes.h Examining data/uniutils-2.27/unirange.h Examining data/uniutils-2.27/utf8error.h Examining data/uniutils-2.27/ExplicateUTF8.c Examining data/uniutils-2.27/binfmt.c Examining data/uniutils-2.27/Get_UTF32_From_UTF8i.c Examining data/uniutils-2.27/unidesc.c Examining data/uniutils-2.27/Get_UTF32i.c Examining data/uniutils-2.27/Read_UMagic_Number.c Examining data/uniutils-2.27/unirange.c Examining data/uniutils-2.27/ExplicateBadUTF8.c Examining data/uniutils-2.27/unifuzz.c Examining data/uniutils-2.27/putu8.c Examining data/uniutils-2.27/unihist.c Examining data/uniutils-2.27/uniname.c Examining data/uniutils-2.27/unames.c Examining data/uniutils-2.27/offsettbl.c Examining data/uniutils-2.27/NelsonTbl.c Examining data/uniutils-2.27/unireverse.c FINAL RESULTS: data/uniutils-2.27/ExplicateUTF8.c:207:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tempstr,"%s",binfmtc(ShiftedByte)); data/uniutils-2.27/ExplicateUTF8.c:212:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tempstr,"%s",binfmtc(ShiftedByte)); data/uniutils-2.27/unihist.c:212:15: [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. if(CntP) printf(fmtstr,100.0 * (((double)CharacterCounts[i])/(double)TotalChars),CharacterCounts[i]); data/uniutils-2.27/uniname.c:156: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(buf,Choseong[ChoseongIndex]); data/uniutils-2.27/uniname.c:157:3: [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,Jungseong[JungseongIndex]); data/uniutils-2.27/uniname.c:158:3: [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,Jongseong[JongseongIndex]); data/uniutils-2.27/uniname.c:552:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg,"Undefined in range %s",Range_Table[RangeIndex].name); data/uniutils-2.27/uniname.c:582:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg,"HANGUL SYLLABLE %s",TransliterateHangulSyllable(c)); data/uniutils-2.27/uniname.c:588:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(msg,"Unknown character in range %s",Range_Table[RangeIndex].name); data/uniutils-2.27/ExplicateUTF8.c:110: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( (oc = getopt(ac,av,"ho:v")) != EOF){ data/uniutils-2.27/unidesc.c:256: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( (oc = getopt(ac,av,"bdhLlmpruvw")) != EOF){ data/uniutils-2.27/unifuzz.c:121:17: [3] (random) random: 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. c = (UTF32) random(); data/uniutils-2.27/unifuzz.c:196: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( (oc = getopt(ac,av,"bghlnqr:s:Suv")) != EOF){ data/uniutils-2.27/unifuzz.c:256:5: [3] (random) srandom: 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. srandom(Seed); data/uniutils-2.27/unihist.c:149:17: [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( (oc = getopt(ac,av,"cghuv")) != EOF){ data/uniutils-2.27/uniname.c:322: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( (oc = getopt(ac,av,"aAbBceghlnpqrs:S:uvV")) != EOF){ data/uniutils-2.27/uniname.c:479:19: [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( (tmpstr = getenv("LINES")) != NULL){ data/uniutils-2.27/ExplicateBadUTF8.c:42:14: [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 const char TrailingBytesForUTF8[256] = { data/uniutils-2.27/ExplicateUTF8.c:47:14: [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 const char TrailingBytesForUTF8[256] = { data/uniutils-2.27/ExplicateUTF8.c:88: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. unsigned char c[6]; data/uniutils-2.27/ExplicateUTF8.c:93: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 tempstr[33]; data/uniutils-2.27/ExplicateUTF8.c:117:16: [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). Offset = atol(optarg); data/uniutils-2.27/ExplicateUTF8.c:131:12: [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). infd = open(av[optind], O_RDONLY); data/uniutils-2.27/ExplicateUTF8.c:218: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(tempstr," "); data/uniutils-2.27/ExplicateUTF8.c:219: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(tempstr,"%08lX",ch); data/uniutils-2.27/Get_UTF32_From_UTF8i.c:38:14: [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 const char TrailingBytesForUTF8[256] = { data/uniutils-2.27/Get_UTF32_From_UTF8i.c:94:19: [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 unsigned char c[6]; data/uniutils-2.27/Read_UMagic_Number.c:52: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 msg[MSGLEN]; data/uniutils-2.27/Read_UMagic_Number.c:68:19: [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 unsigned char hdr[HDRLEN]; data/uniutils-2.27/binfmt.c:44: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. static char str [CBITS+1]; data/uniutils-2.27/binfmt.c:59: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. static char str [SBITS+1]; data/uniutils-2.27/binfmt.c:74: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. static char str [IBITS+1]; data/uniutils-2.27/binfmt.c:89: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. static char str [LBITS+1]; data/uniutils-2.27/unidesc.c:63: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 msg [MSGSIZE]; data/uniutils-2.27/unidesc.c:313:12: [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). infd = open(av[optind],O_RDONLY); data/uniutils-2.27/unidesc.c:482: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(msg,"%ld",Beginning_Of_Range_Bytes); data/uniutils-2.27/unidesc.c:486: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(msg,"%ld",Beginning_Of_Range_Chars); data/uniutils-2.27/unifuzz.c:190: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 msg [MSGSIZE]; data/uniutils-2.27/unifuzz.c:218:32: [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). RandomCharactersToEmit = atol(optarg); data/uniutils-2.27/unifuzz.c:222:14: [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). Seed = atoi(optarg); data/uniutils-2.27/unihist.c:46: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 msg [MSGSIZE]; data/uniutils-2.27/uniname.c:52: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 msg [MSGSIZE]; data/uniutils-2.27/uniname.c:149: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. static char buf[9]; data/uniutils-2.27/uniname.c:247: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 rawstr[24]; data/uniutils-2.27/uniname.c:411:12: [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). infd = open(av[optind],O_RDONLY); data/uniutils-2.27/uniname.c:538: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(rawstrptr+prpos," %02X",rawptr[i]); data/uniutils-2.27/uniname.c:561: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(msg,"CJK character Nelson %4hu",NelsonTbl[FirstNelson].ne); data/uniutils-2.27/uniname.c:564: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(msg,"CJK character Nelson %4hu,%4hu",NelsonTbl[FirstNelson].ne, data/uniutils-2.27/uniname.c:568: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(msg,"CJK character Nelson %4hu,%4hu,%4hu",NelsonTbl[FirstNelson].ne, data/uniutils-2.27/uniname.c:572: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(msg,"CJK character Nelson %4hu,%4hu,%4hu,%4hu", data/uniutils-2.27/unireverse.c:59:14: [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 const char TrailingBytes[256] = { data/uniutils-2.27/ExplicateUTF8.c:146:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). BytesRead = read(infd,(void *) c,1); data/uniutils-2.27/ExplicateUTF8.c:167:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). BytesRead = read(infd,(void *) &c[1],(size_t) BytesNeeded); data/uniutils-2.27/Get_UTF32_From_UTF8i.c:102:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). BytesRead = read(fd,(void *) c,1); data/uniutils-2.27/Get_UTF32_From_UTF8i.c:110:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). BytesRead = read(fd,(void *) &c[BytesSoFar+1],(size_t) (BytesNeeded-BytesSoFar)); data/uniutils-2.27/Get_UTF32i.c:31:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). BytesRead = read(fd,(void *) &ch,sizeof(UTF32)); data/uniutils-2.27/Read_UMagic_Number.c:71:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread=read(infd,hdr,2); data/uniutils-2.27/Read_UMagic_Number.c:79:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread=read(infd,&hdr[2],2); data/uniutils-2.27/Read_UMagic_Number.c:90:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread=read(infd,&hdr[2],1); data/uniutils-2.27/Read_UMagic_Number.c:98:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread=read(infd,&hdr[3],1); data/uniutils-2.27/unidesc.c:483:18: [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). indent = 9 - strlen(msg); data/uniutils-2.27/unidesc.c:487:18: [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). indent = 8 - strlen(msg); data/uniutils-2.27/uniname.c:203:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( (c = getc(stdin)) != EOF){ data/uniutils-2.27/unirange.c:231: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). len = strlen(Range_Table[i].name); data/uniutils-2.27/unireverse.c:167:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c=getc(fp); ANALYSIS SUMMARY: Hits = 65 Lines analyzed = 28961 in approximately 1.16 seconds (25015 lines/second) Physical Source Lines of Code (SLOC) = 28282 Hits@level = [0] 214 [1] 14 [2] 34 [3] 8 [4] 9 [5] 0 Hits@level+ = [0+] 279 [1+] 65 [2+] 51 [3+] 17 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 9.86493 [1+] 2.29828 [2+] 1.80327 [3+] 0.601089 [4+] 0.318224 [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.