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/ncdt-2.1/ncdt.c Examining data/ncdt-2.1/ncdt.h Examining data/ncdt-2.1/ncdt_mp3.c Examining data/ncdt-2.1/util.c FINAL RESULTS: data/ncdt-2.1/ncdt.c:83:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%s/%s",r,ent->d_name); data/ncdt-2.1/ncdt.c:129:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(npref," <%s %d>",nicetime(t->time),t->brmin); data/ncdt-2.1/ncdt.c:131:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(npref," <%s %d-%d>",nicetime(t->time),t->brmin,t->brmax); data/ncdt-2.1/ncdt.c:133:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(npref," <%s>",nicetime(t->time)); data/ncdt-2.1/ncdt.c:136: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(t->name,npref); data/ncdt-2.1/ncdt.c:143:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(npref,"%s%c ",pref,brd?'|':' '); data/ncdt-2.1/ncdt_mp3.c:131:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(p->name+strlen(p->name)," <%s %s%d%c%s%s>",nicetime(secs), data/ncdt-2.1/util.c:24: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,tmp); data/ncdt-2.1/ncdt.c:35:11: [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. if((opt=getopt_long(argc,argv,"db?",longopts,NULL))<0) data/ncdt-2.1/ncdt.c:71: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[4096]; data/ncdt-2.1/ncdt.c:123: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 npref[256]; data/ncdt-2.1/ncdt_mp3.c:25: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 modes[4]="SJDM"; data/ncdt-2.1/ncdt_mp3.c:28: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[1024], *ptr; data/ncdt-2.1/ncdt_mp3.c:30: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. unsigned char head[4], th2[3], vbh[4]; data/ncdt-2.1/ncdt_mp3.c:36:5: [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). fd=open(fname,O_RDONLY); data/ncdt-2.1/util.c:18:9: [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[1024]; data/ncdt-2.1/util.c:19: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 tmp[5]; data/ncdt-2.1/util.c:23: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(tmp,",%03ld",n%1000); data/ncdt-2.1/util.c:26: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(buf,"%ld",n); data/ncdt-2.1/util.c:32:9: [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[1024]; data/ncdt-2.1/util.c:34:13: [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. if(n>3600) sprintf(buf,"%d:%02d:%02d",(int)(n/3600),(int)((n/60)%60), data/ncdt-2.1/util.c:36:13: [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. else sprintf(buf,"%d:%02d",(int)(n/60),(int)(n%60)); data/ncdt-2.1/ncdt.c:135: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). t->name=realloc(t->name,strlen(t->name)+strlen(npref)+1); data/ncdt-2.1/ncdt.c:135:43: [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). t->name=realloc(t->name,strlen(t->name)+strlen(npref)+1); data/ncdt-2.1/ncdt_mp3.c:39:3: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,head,4); data/ncdt-2.1/ncdt_mp3.c:50:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,buf,1024); data/ncdt-2.1/ncdt_mp3.c:54:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,head,4); data/ncdt-2.1/ncdt_mp3.c:60:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,head,4); data/ncdt-2.1/ncdt_mp3.c:63:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,head,4); data/ncdt-2.1/ncdt_mp3.c:67:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,buf,1024); data/ncdt-2.1/ncdt_mp3.c:71:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,head,4); data/ncdt-2.1/ncdt_mp3.c:91:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,vbh,4); data/ncdt-2.1/ncdt_mp3.c:94:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,vbh,4); data/ncdt-2.1/ncdt_mp3.c:97:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,vbh,4); data/ncdt-2.1/ncdt_mp3.c:103:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,vbh,4); data/ncdt-2.1/ncdt_mp3.c:112:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd,th2,3); data/ncdt-2.1/ncdt_mp3.c:130:28: [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). p->name=realloc(p->name,strlen(p->name)+24); data/ncdt-2.1/ncdt_mp3.c:131:20: [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). sprintf(p->name+strlen(p->name)," <%s %s%d%c%s%s>",nicetime(secs), data/ncdt-2.1/util.c:14:19: [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). return !strcmp(s+strlen(s)-strlen(e),e); data/ncdt-2.1/util.c:14: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). return !strcmp(s+strlen(s)-strlen(e),e); ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 378 in approximately 0.03 seconds (10928 lines/second) Physical Source Lines of Code (SLOC) = 314 Hits@level = [0] 3 [1] 18 [2] 13 [3] 1 [4] 8 [5] 0 Hits@level+ = [0+] 43 [1+] 40 [2+] 22 [3+] 9 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 136.943 [1+] 127.389 [2+] 70.0637 [3+] 28.6624 [4+] 25.4777 [5+] 0 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.