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/mp3rename-0.6/mp3rename.c FINAL RESULTS: data/mp3rename-0.6/mp3rename.c:85:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"%s/.mp3rename",getenv("HOME")); /* Lets get the home dir */ data/mp3rename-0.6/mp3rename.c:194:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(artist,"%s%c",artist,input_char); data/mp3rename-0.6/mp3rename.c:207:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(title,"%s%c",title,input_char); data/mp3rename-0.6/mp3rename.c:220:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(album,"%s%c",album,input_char); data/mp3rename-0.6/mp3rename.c:233:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(year,"%s%c",year,input_char); data/mp3rename-0.6/mp3rename.c:255:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(artist,"%s%c",artist,input_char); data/mp3rename-0.6/mp3rename.c:266:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(title,"%s%c",title,input_char); data/mp3rename-0.6/mp3rename.c:278:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(album,"%s%c",album,input_char); data/mp3rename-0.6/mp3rename.c:289:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(year,"%s%c",year,input_char); data/mp3rename-0.6/mp3rename.c:341:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp,"%s%s",newfilename,artist); data/mp3rename-0.6/mp3rename.c:342:17: [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(newfilename,tmp); data/mp3rename-0.6/mp3rename.c:346:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp,"%s%s",newfilename,title); data/mp3rename-0.6/mp3rename.c:347:17: [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(newfilename,tmp); data/mp3rename-0.6/mp3rename.c:351:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp,"%s%s",newfilename,album); data/mp3rename-0.6/mp3rename.c:352:17: [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(newfilename,tmp); data/mp3rename-0.6/mp3rename.c:356:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp,"%s%s",newfilename,year); data/mp3rename-0.6/mp3rename.c:357:17: [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(newfilename,tmp); data/mp3rename-0.6/mp3rename.c:363:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp,"%s0%d",newfilename,track); data/mp3rename-0.6/mp3rename.c:367:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp,"%s%d",newfilename,track); data/mp3rename-0.6/mp3rename.c:369: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(newfilename,tmp); data/mp3rename-0.6/mp3rename.c:381:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp,"%s%c",newfilename,filenamelook[i]); data/mp3rename-0.6/mp3rename.c:382: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(newfilename,tmp); data/mp3rename-0.6/mp3rename.c:388:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(dirsource,"%s",*argv); data/mp3rename-0.6/mp3rename.c:441:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nieuw,"%s%s.mp3",dir,burnname); data/mp3rename-0.6/mp3rename.c:445:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nieuw,"%s%s",dir,newfilename); data/mp3rename-0.6/mp3rename.c:539:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"%s/.mp3rename",getenv("HOME")); data/mp3rename-0.6/mp3rename.c:554:2: [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. fprintf(fp,*argv); data/mp3rename-0.6/mp3rename.c:47: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 ((ch = getopt(argc, argv, "vfhsbia")) != -1) data/mp3rename-0.6/mp3rename.c:85:31: [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. sprintf(str,"%s/.mp3rename",getenv("HOME")); /* Lets get the home dir */ data/mp3rename-0.6/mp3rename.c:539:31: [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. sprintf(str,"%s/.mp3rename",getenv("HOME")); data/mp3rename-0.6/mp3rename.c:29: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 sig[3]; data/mp3rename-0.6/mp3rename.c:30: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 genre[1]; data/mp3rename-0.6/mp3rename.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 filenamelook[100]; data/mp3rename-0.6/mp3rename.c:35: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 str[100]; data/mp3rename-0.6/mp3rename.c:87: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 ( !( fp=fopen(str,"r") ) ) /* if we don't find our config file */ data/mp3rename-0.6/mp3rename.c:89: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(filenamelook,"(&a)-&t"); data/mp3rename-0.6/mp3rename.c:96:3: [2] (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). Risk is low because the source is a constant string. strcat(filenamelook,".mp3"); /* add .mp3 so that the filename will be complete */ data/mp3rename-0.6/mp3rename.c:99: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[31]="", artist[31]="", album[31]="", year[5]="", comment[31]="", fbuf[4], newfilename[160]="",nieuw[150]="",dir[150]="",dirsource[200],fullline[228]="", burnname[29]="", track; data/mp3rename-0.6/mp3rename.c:102: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 ( !( fp=fopen(*argv,"rb+") ) ) /* If the file doesn exist */ data/mp3rename-0.6/mp3rename.c:337: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. char tmp[100]; data/mp3rename-0.6/mp3rename.c:380: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 tmp[100]; data/mp3rename-0.6/mp3rename.c:472:3: [2] (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). Risk is low because the source is a constant string. strcpy(buf,"TAG"); data/mp3rename-0.6/mp3rename.c:519: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 str[100]; data/mp3rename-0.6/mp3rename.c:541:15: [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 ( !( fp=fopen(str,"w") ) ) data/mp3rename-0.6/mp3rename.c:179:21: [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). for( i=0 ; i!=(strlen(filenamelook)) ; i++) data/mp3rename-0.6/mp3rename.c:190:23: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:192:5: [1] (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). Risk is low because the source is a constant character. strcpy(artist,""); data/mp3rename-0.6/mp3rename.c:203:23: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:205:5: [1] (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). Risk is low because the source is a constant character. strcpy(title,""); data/mp3rename-0.6/mp3rename.c:216:23: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:218:5: [1] (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). Risk is low because the source is a constant character. strcpy(album,""); data/mp3rename-0.6/mp3rename.c:229:23: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:231:5: [1] (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). Risk is low because the source is a constant character. strcpy(year,""); data/mp3rename-0.6/mp3rename.c:251:16: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:253:5: [1] (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). Risk is low because the source is a constant character. strcpy(artist,""); data/mp3rename-0.6/mp3rename.c:262:16: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:264:5: [1] (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). Risk is low because the source is a constant character. strcpy(title,""); data/mp3rename-0.6/mp3rename.c:274:16: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:276:5: [1] (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). Risk is low because the source is a constant character. strcpy(album,""); data/mp3rename-0.6/mp3rename.c:285:16: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input_char = getchar(); data/mp3rename-0.6/mp3rename.c:287:5: [1] (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). Risk is low because the source is a constant character. strcpy(year,""); data/mp3rename-0.6/mp3rename.c:333: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). for( i=0 ; i!=(strlen(filenamelook)) ; i++) data/mp3rename-0.6/mp3rename.c:389:5: [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). i=strlen(dirsource)+1; data/mp3rename-0.6/mp3rename.c:411: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). for (i=0; i < strlen(newfilename); i++) data/mp3rename-0.6/mp3rename.c:440:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(burnname,newfilename,sizeof(burnname)-1); data/mp3rename-0.6/mp3rename.c:461:5: [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). i=strlen(astring)-1; data/mp3rename-0.6/mp3rename.c:474:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf,title,30); data/mp3rename-0.6/mp3rename.c:476:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf,artist,30); data/mp3rename-0.6/mp3rename.c:478:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf,album,30); data/mp3rename-0.6/mp3rename.c:480:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf,year,4); data/mp3rename-0.6/mp3rename.c:482:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf,comment,30); data/mp3rename-0.6/mp3rename.c:483:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(buf,genre,1); data/mp3rename-0.6/mp3rename.c:490:5: [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). i=strlen(string); ANALYSIS SUMMARY: Hits = 73 Lines analyzed = 560 in approximately 0.03 seconds (19053 lines/second) Physical Source Lines of Code (SLOC) = 486 Hits@level = [0] 61 [1] 29 [2] 14 [3] 3 [4] 27 [5] 0 Hits@level+ = [0+] 134 [1+] 73 [2+] 44 [3+] 30 [4+] 27 [5+] 0 Hits/KSLOC@level+ = [0+] 275.72 [1+] 150.206 [2+] 90.535 [3+] 61.7284 [4+] 55.5556 [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.