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/xzgv-0.9.2/src/rename.c Examining data/xzgv-0.9.2/src/help.c Examining data/xzgv-0.9.2/src/main.c Examining data/xzgv-0.9.2/src/filedetails.h Examining data/xzgv-0.9.2/src/misc.h Examining data/xzgv-0.9.2/src/getopt1.c Examining data/xzgv-0.9.2/src/help.h Examining data/xzgv-0.9.2/src/copymove.h Examining data/xzgv-0.9.2/src/dither.h Examining data/xzgv-0.9.2/src/updatetn.c Examining data/xzgv-0.9.2/src/misc.c Examining data/xzgv-0.9.2/src/getopt.c Examining data/xzgv-0.9.2/src/resizepic.h Examining data/xzgv-0.9.2/src/backend.h Examining data/xzgv-0.9.2/src/gotodir.c Examining data/xzgv-0.9.2/src/dither.c Examining data/xzgv-0.9.2/src/filedetails.c Examining data/xzgv-0.9.2/src/getopt.h Examining data/xzgv-0.9.2/src/backend.c Examining data/xzgv-0.9.2/src/confirm.c Examining data/xzgv-0.9.2/src/main.h Examining data/xzgv-0.9.2/src/rcfile.c Examining data/xzgv-0.9.2/src/copymove.c Examining data/xzgv-0.9.2/src/resizepic.c Examining data/xzgv-0.9.2/src/updatetn.h Examining data/xzgv-0.9.2/src/confirm.h Examining data/xzgv-0.9.2/src/rcfile.h Examining data/xzgv-0.9.2/src/gotodir.h Examining data/xzgv-0.9.2/src/rename.h FINAL RESULTS: data/xzgv-0.9.2/src/copymove.c:54:1: [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(dst,dstdir); data/xzgv-0.9.2/src/copymove.c:57: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(dst,strrchr(src,'/')+1); data/xzgv-0.9.2/src/copymove.c:59: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(dst,src); data/xzgv-0.9.2/src/copymove.c:204:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"Error %s ",cm_do_move?"moving":"copying"); data/xzgv-0.9.2/src/copymove.c:206:5: [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,(strlen(ptr)>100)?"file":ptr); data/xzgv-0.9.2/src/filedetails.c:77: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,filename); data/xzgv-0.9.2/src/filedetails.c:81: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,filename); data/xzgv-0.9.2/src/filedetails.c:83: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,ptr+1); data/xzgv-0.9.2/src/filedetails.c:200:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%s (%o)", data/xzgv-0.9.2/src/help.c:97:1: [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,cmd_start); data/xzgv-0.9.2/src/help.c:98:1: [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,node); data/xzgv-0.9.2/src/help.c:99:1: [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,cmd_end); data/xzgv-0.9.2/src/help.c:106:4: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(system(buf)!=0) data/xzgv-0.9.2/src/help.c:115:5: [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(buf2,msg); data/xzgv-0.9.2/src/help.c:116:5: [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(buf2,buf); data/xzgv-0.9.2/src/main.c:3141: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(tn,prefix),strcat(tn,ptr); data/xzgv-0.9.2/src/main.c:3141:21: [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). strcpy(tn,prefix),strcat(tn,ptr); data/xzgv-0.9.2/src/main.c:3196:1: [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(msg,prefix); data/xzgv-0.9.2/src/main.c:3197:1: [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(msg,ptr); data/xzgv-0.9.2/src/main.c:3198:1: [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(msg,suffix); data/xzgv-0.9.2/src/main.c:3228:5: [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(oldname,ptr); data/xzgv-0.9.2/src/rcfile.c:212:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cfgfile,"%s/.xzgvrc",home); data/xzgv-0.9.2/src/rename.c:78:1: [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(tn_src,oldname); data/xzgv-0.9.2/src/rename.c:80:1: [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(tn_dst,dest); data/xzgv-0.9.2/src/copymove.c:259:17: [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(*ptr=='~' && getenv("HOME")) /* kludge for home dir */ data/xzgv-0.9.2/src/copymove.c:260:30: [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. ptr=g_strdup_printf("%s%s",getenv("HOME"),ptr+1); data/xzgv-0.9.2/src/getopt.c:213:9: [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. #ifndef getenv data/xzgv-0.9.2/src/getopt.c:214:14: [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. extern char *getenv (); data/xzgv-0.9.2/src/getopt.c:406:21: [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. posixly_correct = getenv ("POSIXLY_CORRECT"); data/xzgv-0.9.2/src/getopt.c:971:1: [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. getopt (argc, argv, optstring) data/xzgv-0.9.2/src/getopt.c:1001:11: [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. c = getopt (argc, argv, "abc:d:0123456789"); data/xzgv-0.9.2/src/getopt.h:134:12: [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. extern int getopt (int __argc, char *const *__argv, const char *__shortopts); data/xzgv-0.9.2/src/getopt.h:136:12: [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. extern int getopt (); data/xzgv-0.9.2/src/getopt.h:140:12: [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. extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, data/xzgv-0.9.2/src/getopt.h:153:12: [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. extern int getopt (); data/xzgv-0.9.2/src/getopt.h:155:12: [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. extern int getopt_long (); data/xzgv-0.9.2/src/getopt1.c:67:1: [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. getopt_long (argc, argv, options, long_options, opt_index) data/xzgv-0.9.2/src/getopt1.c:123: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. c = getopt_long (argc, argv, "abc:d:0123456789", data/xzgv-0.9.2/src/gotodir.c:36:17: [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(*ptr=='~' && getenv("HOME")) /* kludge for home dir */ data/xzgv-0.9.2/src/gotodir.c:37:30: [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. ptr=g_strdup_printf("%s%s",getenv("HOME"),ptr+1); data/xzgv-0.9.2/src/main.c:2913:6: [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(getenv("HOME")==NULL) data/xzgv-0.9.2/src/main.c:2915:9: [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. chdir(getenv("HOME")); data/xzgv-0.9.2/src/rcfile.c:203:12: [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 *home=getenv("HOME"); data/xzgv-0.9.2/src/rcfile.c:482:7: [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. ret=getopt_long(argc,argv,SHORTOPT_STRING,long_opts,&entry); data/xzgv-0.9.2/src/backend.c:160:1: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(rgbcopy,rgb,w*h*3); data/xzgv-0.9.2/src/copymove.c:154: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 buf[256]; data/xzgv-0.9.2/src/copymove.c:300: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 cdir[1024],buf[1024]; data/xzgv-0.9.2/src/dither.c:103:1: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(theline,dbuf,width); data/xzgv-0.9.2/src/filedetails.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 buf[10]; data/xzgv-0.9.2/src/filedetails.c:29:1: [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,"---------"); data/xzgv-0.9.2/src/filedetails.c:62: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 buf[1024]; data/xzgv-0.9.2/src/filedetails.c:76: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,".xvpics/"); data/xzgv-0.9.2/src/filedetails.c:82: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(strrchr(buf,'/')+1,".xvpics/"); data/xzgv-0.9.2/src/filedetails.c:86:8: [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((tn=fopen(buf,"rb"))!=NULL) data/xzgv-0.9.2/src/filedetails.c:177:1: [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,"unknown"); data/xzgv-0.9.2/src/filedetails.c:181: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,"%d (%dk)",(int)sbuf.st_size,((int)sbuf.st_size+1023)/1024); data/xzgv-0.9.2/src/filedetails.c:189:5: [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,"unknown"); data/xzgv-0.9.2/src/filedetails.c:191: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(buf,"%d-%02d-%02d %02d:%02d", data/xzgv-0.9.2/src/filedetails.c:235: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,"%d x %d",w,h); data/xzgv-0.9.2/src/filedetails.c:237: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,"unknown"); data/xzgv-0.9.2/src/gotodir.c:63: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 cdir[1024],buf[1024]; data/xzgv-0.9.2/src/main.c:2436: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 buf[128]; data/xzgv-0.9.2/src/main.c:2442:8: [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((in=fopen(filename,"rb"))==NULL) data/xzgv-0.9.2/src/main.c:2579: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 buf[1024]; data/xzgv-0.9.2/src/main.c:2585:17: [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 xvpic_data[80*60]; /* max thumbnail size */ data/xzgv-0.9.2/src/main.c:2635:5: [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,".xvpics/"); data/xzgv-0.9.2/src/main.c:2900: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 cdir[1024]; data/xzgv-0.9.2/src/main.c:2993: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 buf[1024]; data/xzgv-0.9.2/src/main.c:2995:1: [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,"xzgv"); data/xzgv-0.9.2/src/main.c:2998: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(buf,": "); data/xzgv-0.9.2/src/main.c:3352: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). if((test=fopen(ptr,"rb"))!=NULL) data/xzgv-0.9.2/src/rcfile.c:148: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 inpline[1024]; data/xzgv-0.9.2/src/rcfile.c:200: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 cfgfile[1024]; data/xzgv-0.9.2/src/rcfile.c:214:8: [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((in=fopen(cfgfile,"r"))!=NULL) data/xzgv-0.9.2/src/rcfile.c:216:13: [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((in=fopen(config_file_name="/etc/xzgv.conf","r"))!=NULL) data/xzgv-0.9.2/src/rcfile.c:372:13: [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). int tmp=arg?atoi(arg):0; data/xzgv-0.9.2/src/rcfile.c:465:6: [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). *ptr=atoi(arg); data/xzgv-0.9.2/src/rename.c:77:1: [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(tn_src,".xvpics/"); data/xzgv-0.9.2/src/rename.c:79:1: [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(tn_dst,".xvpics/"); data/xzgv-0.9.2/src/rename.c:102: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 buf[1024]; data/xzgv-0.9.2/src/resizepic.c:65:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(rline+(x*sw)/width*3,theimage+yw*3,3); data/xzgv-0.9.2/src/updatetn.c:113: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). out=fopen(xvpicfn,"wb"); /* keep going even if we can't write */ data/xzgv-0.9.2/src/updatetn.c:138:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(smallpic+y*w,smallpic+y*80*3,w); data/xzgv-0.9.2/src/updatetn.c:154: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 buf[1024]; data/xzgv-0.9.2/src/updatetn.c:171:1: [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,".xvpics/"); data/xzgv-0.9.2/src/updatetn.c:178: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). (test=fopen(buf,"rb"))==NULL) data/xzgv-0.9.2/src/copymove.c:51: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). (dst=malloc(strlen(dstdir)+strlen(src)+2))==NULL) /* +2 for / and NUL */ data/xzgv-0.9.2/src/copymove.c:51:31: [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). (dst=malloc(strlen(dstdir)+strlen(src)+2))==NULL) /* +2 for / and NUL */ data/xzgv-0.9.2/src/copymove.c:55:1: [1] (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 character. strcat(dst,"/"); data/xzgv-0.9.2/src/copymove.c:206: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). strcat(buf,(strlen(ptr)>100)?"file":ptr); data/xzgv-0.9.2/src/getopt.c:236:51: [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 (!defined __STDC__ || !__STDC__) && !defined strlen data/xzgv-0.9.2/src/getopt.c:239: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). extern int strlen (const char *); data/xzgv-0.9.2/src/getopt.c:437: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). int len = nonoption_flags_max_len = strlen (orig_str); data/xzgv-0.9.2/src/getopt.c:658: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). == (unsigned int) strlen (p->name)) data/xzgv-0.9.2/src/getopt.c:682: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/getopt.c:714: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/getopt.c:730: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/getopt.c:735: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/getopt.c:846:51: [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 ((unsigned int) (nameend - nextchar) == strlen (p->name)) data/xzgv-0.9.2/src/getopt.c:869: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/getopt.c:889: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/getopt.c:903: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/getopt.c:907: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). nextchar += strlen (nextchar); data/xzgv-0.9.2/src/help.c:89: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). if((buf=malloc(strlen(cmd_start)+strlen(node)+strlen(cmd_end)+1))==NULL) data/xzgv-0.9.2/src/help.c:89:34: [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((buf=malloc(strlen(cmd_start)+strlen(node)+strlen(cmd_end)+1))==NULL) data/xzgv-0.9.2/src/help.c:89:47: [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((buf=malloc(strlen(cmd_start)+strlen(node)+strlen(cmd_end)+1))==NULL) data/xzgv-0.9.2/src/help.c:111: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). if((buf2=malloc(strlen(msg)+strlen(buf)+1))==NULL) data/xzgv-0.9.2/src/help.c:111:31: [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((buf2=malloc(strlen(msg)+strlen(buf)+1))==NULL) data/xzgv-0.9.2/src/main.c:2395:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((c=fgetc(in))!='\n' && c!=EOF); data/xzgv-0.9.2/src/main.c:2414:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if((c=fgetc(in))=='#') data/xzgv-0.9.2/src/main.c:2636:5: [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,ptr,sizeof(buf)-8-2); /* above string is 8 chars long */ data/xzgv-0.9.2/src/main.c:2861: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). datptr->extofs=strlen(filename); data/xzgv-0.9.2/src/main.c:2999:14: [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). getcwd(buf+strlen(buf),sizeof(buf)-strlen(buf)-2); data/xzgv-0.9.2/src/main.c:2999: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). getcwd(buf+strlen(buf),sizeof(buf)-strlen(buf)-2); data/xzgv-0.9.2/src/main.c:3139: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). tn=malloc(strlen(prefix)+strlen(ptr)+1); data/xzgv-0.9.2/src/main.c:3139: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). tn=malloc(strlen(prefix)+strlen(ptr)+1); data/xzgv-0.9.2/src/main.c:3193: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). msg=malloc(strlen(ptr)+strlen(prefix)+strlen(suffix)+1); data/xzgv-0.9.2/src/main.c:3193:24: [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). msg=malloc(strlen(ptr)+strlen(prefix)+strlen(suffix)+1); data/xzgv-0.9.2/src/main.c:3193: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). msg=malloc(strlen(ptr)+strlen(prefix)+strlen(suffix)+1); data/xzgv-0.9.2/src/main.c:3225: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). if(!ptr || (oldname=malloc(strlen(ptr)+1))==NULL) data/xzgv-0.9.2/src/rcfile.c:139:10: [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(tlen!=strlen(txt)) data/xzgv-0.9.2/src/rcfile.c:158:14: [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(inpline[strlen(inpline)-1]=='\n') inpline[strlen(inpline)-1]=0; data/xzgv-0.9.2/src/rcfile.c:158:48: [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(inpline[strlen(inpline)-1]=='\n') inpline[strlen(inpline)-1]=0; data/xzgv-0.9.2/src/rcfile.c:211: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(home && strlen(home)<sizeof(cfgfile)-strlen("/.xzgvrc")-1) data/xzgv-0.9.2/src/rcfile.c:211:41: [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(home && strlen(home)<sizeof(cfgfile)-strlen("/.xzgvrc")-1) data/xzgv-0.9.2/src/rename.c:67: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). if((tn_src=malloc(8+strlen(oldname)+1))==NULL || data/xzgv-0.9.2/src/rename.c:68: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). (tn_dst=malloc(8+strlen(dest)+1))==NULL) data/xzgv-0.9.2/src/updatetn.c:172:1: [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,ptr,sizeof(buf)-8-2); /* above string is 8 chars long */ ANALYSIS SUMMARY: Hits = 128 Lines analyzed = 9068 in approximately 0.24 seconds (37363 lines/second) Physical Source Lines of Code (SLOC) = 5767 Hits@level = [0] 64 [1] 42 [2] 42 [3] 20 [4] 24 [5] 0 Hits@level+ = [0+] 192 [1+] 128 [2+] 86 [3+] 44 [4+] 24 [5+] 0 Hits/KSLOC@level+ = [0+] 33.2929 [1+] 22.1952 [2+] 14.9124 [3+] 7.62962 [4+] 4.16161 [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.