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/loki-2.4.7.4/include/bin_tree.h Examining data/loki-2.4.7.4/include/getopt.h Examining data/loki-2.4.7.4/include/libhdr.h Examining data/loki-2.4.7.4/include/lk_long.h Examining data/loki-2.4.7.4/include/loki_struct.h Examining data/loki-2.4.7.4/include/min_deg.h Examining data/loki-2.4.7.4/include/ranlib.h Examining data/loki-2.4.7.4/include/shared_peel.h Examining data/loki-2.4.7.4/include/sparse.h Examining data/loki-2.4.7.4/include/utils.h Examining data/loki-2.4.7.4/include/version.h Examining data/loki-2.4.7.4/libsrc/bin_tree.c Examining data/loki-2.4.7.4/libsrc/genrand.c Examining data/loki-2.4.7.4/libsrc/getopt_long.c Examining data/loki-2.4.7.4/libsrc/io_stuff.c Examining data/loki-2.4.7.4/libsrc/min_deg.c Examining data/loki-2.4.7.4/libsrc/mkbackup.c Examining data/loki-2.4.7.4/libsrc/mt.h Examining data/loki-2.4.7.4/libsrc/peel_utils.c Examining data/loki-2.4.7.4/libsrc/qsort.c Examining data/loki-2.4.7.4/libsrc/ran_xtra.c Examining data/loki-2.4.7.4/libsrc/ranlib.c Examining data/loki-2.4.7.4/libsrc/remember.c Examining data/loki-2.4.7.4/libsrc/strsep.c Examining data/loki-2.4.7.4/libsrc/utils.c Examining data/loki-2.4.7.4/lokisrc/alloc_loki.c Examining data/loki-2.4.7.4/lokisrc/calc_var_locus.c Examining data/loki-2.4.7.4/lokisrc/calc_var_locus.h Examining data/loki-2.4.7.4/lokisrc/count_dbr.c Examining data/loki-2.4.7.4/lokisrc/count_dbr.h Examining data/loki-2.4.7.4/lokisrc/gen_pen.c Examining data/loki-2.4.7.4/lokisrc/gen_pen.h Examining data/loki-2.4.7.4/lokisrc/genedrop.c Examining data/loki-2.4.7.4/lokisrc/genedrop.h Examining data/loki-2.4.7.4/lokisrc/get_founders.c Examining data/loki-2.4.7.4/lokisrc/get_par_probs.c Examining data/loki-2.4.7.4/lokisrc/get_par_probs.h Examining data/loki-2.4.7.4/lokisrc/handle_res.c Examining data/loki-2.4.7.4/lokisrc/handle_res.h Examining data/loki-2.4.7.4/lokisrc/kinship.c Examining data/loki-2.4.7.4/lokisrc/kinship.h Examining data/loki-2.4.7.4/lokisrc/loki.c Examining data/loki-2.4.7.4/lokisrc/loki.h Examining data/loki-2.4.7.4/lokisrc/loki_complex_peel.c Examining data/loki-2.4.7.4/lokisrc/loki_dump.c Examining data/loki-2.4.7.4/lokisrc/loki_dump.h Examining data/loki-2.4.7.4/lokisrc/loki_ibd.c Examining data/loki-2.4.7.4/lokisrc/loki_ibd.h Examining data/loki-2.4.7.4/lokisrc/loki_identity.c Examining data/loki-2.4.7.4/lokisrc/loki_init.c Examining data/loki-2.4.7.4/lokisrc/loki_monitor.c Examining data/loki-2.4.7.4/lokisrc/loki_monitor.h Examining data/loki-2.4.7.4/lokisrc/loki_npl.c Examining data/loki-2.4.7.4/lokisrc/loki_npl.h Examining data/loki-2.4.7.4/lokisrc/loki_output.c Examining data/loki-2.4.7.4/lokisrc/loki_output.h Examining data/loki-2.4.7.4/lokisrc/loki_peel.c Examining data/loki-2.4.7.4/lokisrc/loki_peel.h Examining data/loki-2.4.7.4/lokisrc/loki_pen.c Examining data/loki-2.4.7.4/lokisrc/loki_sample.c Examining data/loki-2.4.7.4/lokisrc/loki_scan.h Examining data/loki-2.4.7.4/lokisrc/loki_setup.c Examining data/loki-2.4.7.4/lokisrc/loki_simple_peel.c Examining data/loki-2.4.7.4/lokisrc/loki_simple_peel.h Examining data/loki-2.4.7.4/lokisrc/loki_simple_sample.c Examining data/loki-2.4.7.4/lokisrc/loki_tlmoves.c Examining data/loki-2.4.7.4/lokisrc/loki_tlmoves.h Examining data/loki-2.4.7.4/lokisrc/loki_trait_simple_peel.c Examining data/loki-2.4.7.4/lokisrc/loki_trait_simple_peel.h Examining data/loki-2.4.7.4/lokisrc/loki_trait_simple_sample.c Examining data/loki-2.4.7.4/lokisrc/loki_utils.c Examining data/loki-2.4.7.4/lokisrc/mat_utils.c Examining data/loki-2.4.7.4/lokisrc/mat_utils.h Examining data/loki-2.4.7.4/lokisrc/meiosis_scan.c Examining data/loki-2.4.7.4/lokisrc/meiosis_scan.h Examining data/loki-2.4.7.4/lokisrc/output_recomb.c Examining data/loki-2.4.7.4/lokisrc/output_recomb.h Examining data/loki-2.4.7.4/lokisrc/param_parse.h Examining data/loki-2.4.7.4/lokisrc/pass_founder_genes.c Examining data/loki-2.4.7.4/lokisrc/peel_to_par.c Examining data/loki-2.4.7.4/lokisrc/print_data.c Examining data/loki-2.4.7.4/lokisrc/print_data.h Examining data/loki-2.4.7.4/lokisrc/read_binfiles.c Examining data/loki-2.4.7.4/lokisrc/read_solar_idfile.c Examining data/loki-2.4.7.4/lokisrc/read_solar_idfile.h Examining data/loki-2.4.7.4/lokisrc/sample_cens.c Examining data/loki-2.4.7.4/lokisrc/sample_cens.h Examining data/loki-2.4.7.4/lokisrc/sample_effects.c Examining data/loki-2.4.7.4/lokisrc/sample_effects.h Examining data/loki-2.4.7.4/lokisrc/sample_nu.c Examining data/loki-2.4.7.4/lokisrc/sample_nu.h Examining data/loki-2.4.7.4/lokisrc/sample_rand.c Examining data/loki-2.4.7.4/lokisrc/sample_rand.h Examining data/loki-2.4.7.4/lokisrc/sample_segs.h Examining data/loki-2.4.7.4/lokisrc/seg_pen.c Examining data/loki-2.4.7.4/lokisrc/seg_pen.h Examining data/loki-2.4.7.4/lokisrc/update_segs.c Examining data/loki-2.4.7.4/lokisrc/update_segs.h Examining data/loki-2.4.7.4/lokisrc/param_lex.c Examining data/loki-2.4.7.4/lokisrc/param_parse.c Examining data/loki-2.4.7.4/orig_sources/mt19937.c Examining data/loki-2.4.7.4/orig_sources/qsort.c Examining data/loki-2.4.7.4/prepsrc/calc_nrm.c Examining data/loki-2.4.7.4/prepsrc/check_het.c Examining data/loki-2.4.7.4/prepsrc/check_het.h Examining data/loki-2.4.7.4/prepsrc/cleanup.c Examining data/loki-2.4.7.4/prepsrc/compat/compat.c Examining data/loki-2.4.7.4/prepsrc/compat/compat.h Examining data/loki-2.4.7.4/prepsrc/compat/merlin.c Examining data/loki-2.4.7.4/prepsrc/compat/merlin.h Examining data/loki-2.4.7.4/prepsrc/control_lex.c Examining data/loki-2.4.7.4/prepsrc/control_parse.c Examining data/loki-2.4.7.4/prepsrc/control_parse.h Examining data/loki-2.4.7.4/prepsrc/gen_elim.c Examining data/loki-2.4.7.4/prepsrc/get_marker_name.c Examining data/loki-2.4.7.4/prepsrc/init_fam.c Examining data/loki-2.4.7.4/prepsrc/match_records.c Examining data/loki-2.4.7.4/prepsrc/output_data.c Examining data/loki-2.4.7.4/prepsrc/prep.c Examining data/loki-2.4.7.4/prepsrc/prep_do_peel_op.c Examining data/loki-2.4.7.4/prepsrc/prep_peel.h Examining data/loki-2.4.7.4/prepsrc/prep_utils.c Examining data/loki-2.4.7.4/prepsrc/prep_utils.h Examining data/loki-2.4.7.4/prepsrc/read_data.c Examining data/loki-2.4.7.4/prepsrc/recode_fact.c Examining data/loki-2.4.7.4/prepsrc/restrict_data.c Examining data/loki-2.4.7.4/prepsrc/scan.h Examining data/loki-2.4.7.4/prepsrc/scanner.h Examining data/loki-2.4.7.4/prepsrc/setup_ped.c Examining data/loki-2.4.7.4/prepsrc/test_het.c Examining data/loki-2.4.7.4/prepsrc/write_data.c Examining data/loki-2.4.7.4/prepsrc/write_report.c Examining data/loki-2.4.7.4/utils/hist.c Examining data/loki-2.4.7.4/utils/qavg.c FINAL RESULTS: data/loki-2.4.7.4/include/libhdr.h:15:7: [4] (shell) popen: 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. FILE *popen(const char *,const char *); data/loki-2.4.7.4/libsrc/getopt_long.c:121:24: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. if(fmt != NULL) (void)vfprintf(stderr, fmt, ap); data/loki-2.4.7.4/libsrc/io_stuff.c:110:29: [4] (shell) execlp: 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(read_flag==READ) (void)execlp(filterprog,filterprog,arg,(char *)0); data/loki-2.4.7.4/libsrc/io_stuff.c:111:14: [4] (shell) execlp: 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. else (void)execlp(filterprog,filterprog,arg,(char *) 0); data/loki-2.4.7.4/libsrc/io_stuff.c:128:7: [4] (shell) popen: 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. FILE *popen(const char *command,const char *type) data/loki-2.4.7.4/libsrc/io_stuff.c:179:8: [4] (shell) execl: 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. (int)execl("/bin/sh","sh","-c",command,(char *)0); data/loki-2.4.7.4/libsrc/mkbackup.c:54: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). (void)strcpy(buf,fname); data/loki-2.4.7.4/libsrc/mkbackup.c:67:10: [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). (void)strcpy(buf,fname); data/loki-2.4.7.4/libsrc/mkbackup.c:95:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(buf,"%s~%d~",fname,bkfiles[k].num+1); data/loki-2.4.7.4/libsrc/utils.c:64:8: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vfprintf(stderr,fmt,args); data/loki-2.4.7.4/libsrc/utils.c:260: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). return strcpy(s1,s); data/loki-2.4.7.4/libsrc/utils.c:308: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). (void)strcpy(buf,logfile); data/loki-2.4.7.4/lokisrc/loki.c:228: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). (void)strcpy(tfile,optarg); data/loki-2.4.7.4/lokisrc/loki_ibd.c:940:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fname,"%s/mibd.%s.%-15g",dname,linkage[link].name,x); data/loki-2.4.7.4/lokisrc/loki_init.c:162:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(linkage[i].name,"%s(%d)",marker[i].name,marker[i].index); data/loki-2.4.7.4/lokisrc/loki_monitor.c:355:8: [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). (void)strcpy(sock.sun_path,monitor_sock_addr); data/loki-2.4.7.4/lokisrc/param_lex.c:814: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). (void)strcpy(linebuf1,linebuf); data/loki-2.4.7.4/lokisrc/param_parse.c:793:21: [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 YYFPRINTF fprintf data/loki-2.4.7.4/lokisrc/param_parse.c:2455:8: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vfprintf(stderr,fmt,args); data/loki-2.4.7.4/lokisrc/param_parse.c:2467:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vfprintf(stderr,fmt,args); data/loki-2.4.7.4/lokisrc/print_data.c:102:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(s,"%s_idx",filename); data/loki-2.4.7.4/lokisrc/print_data.c:192:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(s,"%s_idx",og->file); data/loki-2.4.7.4/prepsrc/compat/merlin.c:172:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cols[ncols].name,"%s__",p1); data/loki-2.4.7.4/prepsrc/control_lex.c:1372: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). (void)strcpy(linebuf1,linebuf); data/loki-2.4.7.4/prepsrc/control_parse.c:1130:21: [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 YYFPRINTF fprintf data/loki-2.4.7.4/prepsrc/control_parse.c:3138:8: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vfprintf(stderr,fmt,args); data/loki-2.4.7.4/prepsrc/control_parse.c:3149:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vfprintf(stderr,fmt,args); data/loki-2.4.7.4/prepsrc/control_parse.c:3240:9: [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). (void)strcat(s1,s2); data/loki-2.4.7.4/prepsrc/control_parse.c:3243: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). (void)strcpy(s1,s2); data/loki-2.4.7.4/prepsrc/control_parse.c:3502:32: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if(sd->vtype&ST_ARRAY) (void)sprintf(nbuf,"%s(%d)",sd->name,i+1); data/loki-2.4.7.4/prepsrc/control_parse.c:3503: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). else (void)strcpy(nbuf,sd->name); data/loki-2.4.7.4/prepsrc/control_parse.c:3616:10: [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). (void)strcpy(linebuf1,linebuf); data/loki-2.4.7.4/prepsrc/control_parse.c:3626: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). (void)strcpy(linebuf1,linebuf); data/loki-2.4.7.4/prepsrc/gen_elim.c:1247:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(fname1,"%s/%s.er%s",ErrorDir,s,fg?"r1":"r"); data/loki-2.4.7.4/prepsrc/gen_elim.c:1250:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(fname2,"%s.er%s",s,fg?"r1":"r"); data/loki-2.4.7.4/prepsrc/get_marker_name.c:44:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(s,"%s(%s)",mark->var->name,tbuf); data/loki-2.4.7.4/prepsrc/get_marker_name.c:48: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). (void)strcpy(s,mark->var->name); data/loki-2.4.7.4/prepsrc/read_data.c:199:36: [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). if(!syst_var[IGNORE_CASE]) (void)strcpy(p,p1); data/loki-2.4.7.4/prepsrc/read_data.c:710:15: [4] (shell) popen: 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(!(fptr=popen(infile->name,"r"))) { data/loki-2.4.7.4/prepsrc/restrict_data.c:300:10: [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). (void)strcpy(res->arg.string,s); data/loki-2.4.7.4/prepsrc/restrict_data.c:301:10: [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). (void)strcat(res->arg.string,s1); data/loki-2.4.7.4/utils/hist.c:58: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). (void)strcpy(Outfile,optarg); data/loki-2.4.7.4/utils/hist.c:67: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). (void)strcpy(PFile,optarg); data/loki-2.4.7.4/utils/hist.c:108: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). (void)strcpy(Infile,argv[optind]); data/loki-2.4.7.4/include/getopt.h:66:6: [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. int getopt_long(int, char * const *, const char *, data/loki-2.4.7.4/include/getopt.h:72:6: [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. int getopt(int, char * const *, const char *); data/loki-2.4.7.4/libsrc/getopt_long.c:320: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. posixly_correct = (getenv("POSIXLY_CORRECT") != NULL); data/loki-2.4.7.4/libsrc/getopt_long.c:504: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(int nargc, char * const *nargv, const char *options) data/loki-2.4.7.4/libsrc/getopt_long.c:524: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(nargc, nargv, options, long_options, idx) data/loki-2.4.7.4/lokisrc/loki.c:223: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. while((c=getopt(argc,argv,"arvf:p:d:"))!=-1) switch(c) { data/loki-2.4.7.4/prepsrc/compat/merlin.c:92: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. while((c=getopt_long(argc,argv,"evm:d:p:x:l:X:",longopts,0))!=-1) switch(c) { data/loki-2.4.7.4/prepsrc/control_lex.c:2764: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. if((s=getenv(ptr))) { data/loki-2.4.7.4/prepsrc/prep.c:64: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. while((c=getopt(argc,argv,"evX:d:p:"))!=-1) switch(c) { data/loki-2.4.7.4/utils/hist.c:32: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. else while ((c=getopt(argc,argv,"hcfo:r:b:i:p:"))!=-1) switch(c) { data/loki-2.4.7.4/utils/qavg.c:187: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. while((c=getopt(argc,argv,"lr:p:"))!=-1) switch(c) { data/loki-2.4.7.4/libsrc/genrand.c:167: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[256],*fname1; data/loki-2.4.7.4/libsrc/genrand.c:179:7: [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). fptr=fopen(fname1,"r"); data/loki-2.4.7.4/libsrc/genrand.c:293: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). fptr=fopen(fname1,"w"); data/loki-2.4.7.4/libsrc/getopt_long.c:174:6: [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 **) nargv)[pos] = nargv[cstart]; data/loki-2.4.7.4/libsrc/getopt_long.c:176:6: [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 **)nargv)[cstart] = swap; data/loki-2.4.7.4/libsrc/io_stuff.c:88:9: [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). fd1=open(fname,O_RDONLY,0666); data/loki-2.4.7.4/libsrc/qsort.c:130:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy (pivot, mid, size); data/loki-2.4.7.4/libsrc/utils.c:317: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(logfile) flog=fopen(logfile,mode); data/loki-2.4.7.4/libsrc/utils.c:340: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 hname[MAXHOSTNAMELEN+1]; data/loki-2.4.7.4/libsrc/utils.c:343:17: [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(lfile) flog=fopen(lfile,"a"); data/loki-2.4.7.4/libsrc/utils.c:351:11: [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. (void)strcpy(hname,"UNKNOWN"); data/loki-2.4.7.4/lokisrc/gen_pen.c:993:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(ops->inv,gp_inv1,n_inv*sizeof(int)); data/loki-2.4.7.4/lokisrc/gen_pen.c:994:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(ops->pflag,pflag,n_inv*sizeof(int)); data/loki-2.4.7.4/lokisrc/loki.c:273:12: [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((fptr=fopen(argv[optind],"r"))) i=ReadParam(fptr,argv[optind],&ranseed_set); data/loki-2.4.7.4/lokisrc/loki.c:337: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). fptr=fopen(tname,"a"); data/loki-2.4.7.4/lokisrc/loki_dump.c:59: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). } else fdump=fopen(Dumpfile,"r"); data/loki-2.4.7.4/lokisrc/loki_dump.c:463:17: [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 fdump=fopen(Dumpfile,"w"); data/loki-2.4.7.4/lokisrc/loki_ibd.c:598:4: [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(fname,name,i); data/loki-2.4.7.4/lokisrc/loki_ibd.c:599:4: [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(fname+i,".gz"); data/loki-2.4.7.4/lokisrc/loki_ibd.c:610: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). fptr=fopen(fname,"w"); data/loki-2.4.7.4/lokisrc/loki_ibd.c:945:6: [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(fname+i,".gz"); data/loki-2.4.7.4/lokisrc/loki_ibd.c:952:17: [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 fptr=fopen(fname,"w"); data/loki-2.4.7.4/lokisrc/loki_monitor.c:100: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[256],buf1[8]; data/loki-2.4.7.4/lokisrc/loki_monitor.c:221: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. buflen=sprintf(buf,"%d %d %d %g %g %g %g\n",lpar->it, data/loki-2.4.7.4/lokisrc/loki_monitor.c:232: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. buflen=sprintf(buf,"%d %d %d %d %d\n",lpar->num_iter, data/loki-2.4.7.4/lokisrc/loki_monitor.c:262: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. buflen=sprintf(buf,"%d\n",(int)par_id); data/loki-2.4.7.4/lokisrc/loki_monitor.c:340: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[256],*p=0; data/loki-2.4.7.4/lokisrc/loki_monitor.c:341: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 host[MAXHOSTNAMELEN+1]; data/loki-2.4.7.4/lokisrc/loki_monitor.c:349:10: [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. (void)strcpy(host,"UNKNOWN"); data/loki-2.4.7.4/lokisrc/loki_monitor.c:380:10: [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). pid=atoi(buf); data/loki-2.4.7.4/lokisrc/loki_monitor.c:385: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(!(fptr=fopen(loki_pid_file,"r"))) { data/loki-2.4.7.4/lokisrc/loki_monitor.c:421:12: [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(!(fptr=fopen(loki_pid_file,"w"))) { data/loki-2.4.7.4/lokisrc/loki_sample.c:210: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). if(!(qptr=fopen(qname,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,qname); data/loki-2.4.7.4/lokisrc/loki_sample.c:226:27: [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(mposname) if(!(fmpos=fopen(mposname,"a"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,mposname); data/loki-2.4.7.4/lokisrc/loki_sample.c:227:27: [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(Freqfile) if(!(ffreq=fopen(Freqfile,"a"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,Freqfile); data/loki-2.4.7.4/lokisrc/loki_sample.c:229: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(!(fptr=fopen(Outputfile,"a"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,Outputfile); data/loki-2.4.7.4/lokisrc/loki_sample.c:230: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(OutputPosfile) if(!(fpos=fopen(OutputPosfile,"r+"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,OutputPosfile); data/loki-2.4.7.4/lokisrc/loki_sample.c:237:27: [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(mposname) if(!(fmpos=fopen(mposname,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,mposname); data/loki-2.4.7.4/lokisrc/loki_sample.c:238:27: [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(Freqfile) if(!(ffreq=fopen(Freqfile,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,Freqfile); data/loki-2.4.7.4/lokisrc/loki_sample.c:240: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(!(fptr=fopen(Outputfile,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,Outputfile); data/loki-2.4.7.4/lokisrc/loki_sample.c:241: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(OutputPosfile) if(!(fpos=fopen(OutputPosfile,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,OutputPosfile); data/loki-2.4.7.4/lokisrc/loki_sample.c:571: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). if(!(fptr=fopen(Polyfile,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for output\n",FUNC_NAME,Polyfile); data/loki-2.4.7.4/lokisrc/loki_scan.h:23: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. extern char *fname_list[MAX_INCLUDE+1]; data/loki-2.4.7.4/lokisrc/loki_setup.c:39: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 *sexstr[2]={"female","male"}; data/loki-2.4.7.4/lokisrc/meiosis_scan.c:215: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(temp_list,nnfd_list,sizeof(int)*nnfd_st[n_comp]); data/loki-2.4.7.4/lokisrc/meiosis_scan.c:218: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(temp_list,par_list,sizeof(int)*par_st[n_comp]); data/loki-2.4.7.4/lokisrc/meiosis_scan.c:221: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(temp_list,gpfam_list,sizeof(int)*gpfam_st[n_comp]); data/loki-2.4.7.4/lokisrc/meiosis_scan.c:224: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(temp_list,fam_list,sizeof(int)*fam_st[n_comp]); data/loki-2.4.7.4/lokisrc/output_recomb.c:46:12: [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(!(fptr=fopen(Recombfile,"w"))) { data/loki-2.4.7.4/lokisrc/param_lex.c:557: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 linebuf[512],linebuf1[512]; data/loki-2.4.7.4/lokisrc/param_lex.c:561: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 *fname_list[MAX_INCLUDE+1]; data/loki-2.4.7.4/lokisrc/param_lex.c:921:34: [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). { tokenpos+=yyleng; yylval.value=atoi(yytext); return INTEGER; } data/loki-2.4.7.4/lokisrc/param_lex.c:1949:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(s1,s,size); data/loki-2.4.7.4/lokisrc/param_lex.c:2030: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(!(fptr=fopen(fname,"r"))) { data/loki-2.4.7.4/lokisrc/param_parse.c:2250: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 *sexstr[2]={"female","male"}; data/loki-2.4.7.4/lokisrc/print_data.c:45:12: [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(!(fptr=fopen(filename,"w"))) { data/loki-2.4.7.4/lokisrc/print_data.c:103:12: [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(!(fptr=fopen(s,"w"))) { data/loki-2.4.7.4/lokisrc/print_data.c:150:12: [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(!(fptr=fopen(og->file,"w"))) { data/loki-2.4.7.4/lokisrc/print_data.c:193:12: [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(!(fptr=fopen(s,"w"))) { data/loki-2.4.7.4/lokisrc/read_binfiles.c:97: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). } else if(!(fptr=fopen(fname,"r"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for reading\n",FUNC_NAME,fname); data/loki-2.4.7.4/lokisrc/read_binfiles.c:183:12: [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(!(fptr=fopen(fname,"r"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for reading\n",FUNC_NAME,fname); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:131: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[BUFSIZE],buf1[BUFSIZE],*fname,*p,*p1; data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:158:12: [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(!(fptr=fopen(SOLAR_PEDINDEX_FILE,"r"))) abt(__FILE__,__LINE__,"%s(): Couldn't open file '%s' for input\n",FUNC_NAME,SOLAR_PEDINDEX_FILE); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:164:2: [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(fname,buf,l+1); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:171: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). j=atoi(buf); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:198:12: [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(!(fptr=fopen(fname,"r"))) abt(__FILE__,__LINE__,"%s(): Couldn't open file '%s' for input\n",FUNC_NAME,fname); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:204:4: [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(buf1,buf+ibdid_start,ibdid_width); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:206: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). i=atoi(buf1); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:212:5: [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(buf1,buf+famid_start,famid_width); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:223:4: [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(p1,buf+id_start,id_width); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:233:21: [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). else data.value=atoi(p); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:241:20: [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). else data.value=atoi(p1); data/loki-2.4.7.4/orig_sources/qsort.c:130:4: [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 (pivot, mid, size); data/loki-2.4.7.4/prepsrc/calc_nrm.c:107: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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/calc_nrm.c:122:20: [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(!(fptr=fopen(fname,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for writing.\n",FUNC_NAME,fname); data/loki-2.4.7.4/prepsrc/check_het.c:57:11: [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((fptr=fopen(argv[1],"r"))) err=ReadControl(fptr,argv[1],&LogFile); data/loki-2.4.7.4/prepsrc/compat/merlin.c:65: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[BUFSIZE]; data/loki-2.4.7.4/prepsrc/compat/merlin.c:127:12: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(!(fptr=tmpfile())) ABT_FUNC("Couldn't create temporary file\n"); data/loki-2.4.7.4/prepsrc/compat/merlin.c:138:11: [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(!(fin=fopen(datafile,"r"))) { data/loki-2.4.7.4/prepsrc/compat/merlin.c:177: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(cols[ncols].name,"var_%d",anon_var); data/loki-2.4.7.4/prepsrc/control_lex.c:1056: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 linebuf[LINEBUFSIZE],linebuf1[LINEBUFSIZE]; data/loki-2.4.7.4/prepsrc/control_lex.c:1059: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 *fname_list[MAX_INCLUDE+1]; data/loki-2.4.7.4/prepsrc/control_lex.c:1063: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 stringbuf[MAX_STRING]; data/loki-2.4.7.4/prepsrc/control_lex.c:1673:34: [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). { tokenpos+=yyleng; yylval.value=atoi(yytext); return INTEGER; } data/loki-2.4.7.4/prepsrc/control_lex.c:2635: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(!(fptr=fopen(fname,"r"))) { data/loki-2.4.7.4/prepsrc/control_lex.c:2666:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(s1,s,size); data/loki-2.4.7.4/prepsrc/control_lex.c:2770:11: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(stringptr+i,s,k); data/loki-2.4.7.4/prepsrc/gen_elim.c:1549: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). } else if(!(fptr=fopen(*fname,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for writing\n",FUNC_NAME,*fname); data/loki-2.4.7.4/prepsrc/gen_elim.c:1911: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). ferr=fopen(fname1,"w"); data/loki-2.4.7.4/prepsrc/gen_elim.c:1930: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). ferr=fopen(fname1,"w"); data/loki-2.4.7.4/prepsrc/gen_elim.c:2203: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 bf[256],bf1[256],bf2[256],bf3[256]; data/loki-2.4.7.4/prepsrc/gen_elim.c:2225: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(!(lfptr=fopen(OutputLaurFile,"w"))) perror("Couldn't open output file"); data/loki-2.4.7.4/prepsrc/gen_elim.c:2257:15: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(!(fptr1=tmpfile())) ABT_FUNC("Couldn't open temporary file\n"); data/loki-2.4.7.4/prepsrc/gen_elim.c:2272: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((ferr=fopen(fname1,"r"))) { data/loki-2.4.7.4/prepsrc/gen_elim.c:2334:18: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). if(!(fptr1=tmpfile())) ABT_FUNC("Couldn't open temporary file\n"); data/loki-2.4.7.4/prepsrc/gen_elim.c:2520:11: [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). ferr=fopen(fname1,"w"); data/loki-2.4.7.4/prepsrc/gen_elim.c:2522:20: [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(lfile) flog=fopen(lfile,"a"); data/loki-2.4.7.4/prepsrc/get_marker_name.c:34: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 *s,tbuf[32]; data/loki-2.4.7.4/prepsrc/get_marker_name.c:41:9: [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. (void)sprintf(tbuf,"%d",mark->index); data/loki-2.4.7.4/prepsrc/init_fam.c:97:12: [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((flog=fopen(tname,"a"))) { data/loki-2.4.7.4/prepsrc/output_data.c:39:11: [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((fptr=fopen(OutputFile,"w"))) { data/loki-2.4.7.4/prepsrc/output_data.c:72:11: [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((fptr=fopen(OutputRawFile,"w"))) { data/loki-2.4.7.4/prepsrc/prep.c:90:11: [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((fptr=fopen(argv[optind],"r"))) err=ReadControl(fptr,argv[optind],&LogFile); data/loki-2.4.7.4/prepsrc/prep_utils.c:78: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]; data/loki-2.4.7.4/prepsrc/read_data.c:443: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 single1[2],single2[2]; data/loki-2.4.7.4/prepsrc/read_data.c:679: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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/read_data.c:718: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(!(fptr=fopen(infile->name,"r"))) { data/loki-2.4.7.4/prepsrc/read_data.c:980:4: [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(markers+j,markers+i,sizeof(struct Marker)); data/loki-2.4.7.4/prepsrc/scanner.h:15: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. extern char *fname_list[MAX_INCLUDE+1]; data/loki-2.4.7.4/prepsrc/setup_ped.c:251: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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/setup_ped.c:487:9: [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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/setup_ped.c:564: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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/setup_ped.c:693:9: [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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/setup_ped.c:893: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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/setup_ped.c:964: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). flog=fopen(tname,"a"); data/loki-2.4.7.4/prepsrc/test_het.c:161:23: [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(k && Log && (flog=fopen(Log,"a"))) { data/loki-2.4.7.4/prepsrc/write_data.c:127:12: [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(!(fptr=fopen(fname,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for writing\n",FUNC_NAME,fname); data/loki-2.4.7.4/prepsrc/write_data.c:137: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). } else if(!(fptr=fopen(fname,"w"))) abt(__FILE__,__LINE__,"%s(): File Error. Couldn't open '%s' for writing\n",FUNC_NAME,fname); data/loki-2.4.7.4/prepsrc/write_report.c:51: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). flog=fopen(tname,"a"); data/loki-2.4.7.4/utils/hist.c:27: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[512],*p,*p1,*Outfile=0,*Infile=0,*PFile=0; data/loki-2.4.7.4/utils/hist.c:70:9: [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). nbins=atoi(optarg); data/loki-2.4.7.4/utils/hist.c:73:7: [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). idx=atoi(optarg); data/loki-2.4.7.4/utils/hist.c:120: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). if(!(fptr=fopen(PFile,"r"))) { data/loki-2.4.7.4/utils/hist.c:157: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). if(!(fptr=fopen(Infile,"r"))) { data/loki-2.4.7.4/utils/hist.c:232: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). if(!(fptr=fopen(Outfile,"w"))) { data/loki-2.4.7.4/utils/qavg.c:58:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(data1,data+blkptr-col,col*sizeof(double)); data/loki-2.4.7.4/utils/qavg.c:59:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(cols1,cols+blkptr-col,col*sizeof(int)); data/loki-2.4.7.4/utils/qavg.c:208: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). if(!(fptr=fopen(argv[i],"r"))) { data/loki-2.4.7.4/libsrc/genrand.c:11:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). #define umask 0x80000000U data/loki-2.4.7.4/libsrc/genrand.c:13:30: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). #define mixBits(u,v) (((u)&umask)|((v)&lmask)) data/loki-2.4.7.4/libsrc/getopt_long.c:204: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). current_argv_len = strlen(current_argv); data/loki-2.4.7.4/libsrc/getopt_long.c:212:7: [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(long_options[i].name) == current_argv_len) { data/loki-2.4.7.4/libsrc/mkbackup.c:51: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). j=(int)strlen(fname); data/loki-2.4.7.4/libsrc/mkbackup.c:63: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). j=(int)strlen(fname); data/loki-2.4.7.4/libsrc/utils.c:90:6: [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). s=strlen(p)+2+strlen(file_dir); data/loki-2.4.7.4/libsrc/utils.c:90: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). s=strlen(p)+2+strlen(file_dir); data/loki-2.4.7.4/libsrc/utils.c:259: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). if(!(s1=malloc(strlen(s)+1))) ABT_FUNC(MMsg); data/loki-2.4.7.4/libsrc/utils.c:276:4: [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). l=strlen(s)+strlen(file_prefix)+2; data/loki-2.4.7.4/libsrc/utils.c:276: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). l=strlen(s)+strlen(file_prefix)+2; data/loki-2.4.7.4/libsrc/utils.c:277: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). if(file_dir) l+=strlen(file_dir)+1; data/loki-2.4.7.4/libsrc/utils.c:305: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). j=(int)strlen(logfile); data/loki-2.4.7.4/lokisrc/loki.c:225: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(optarg); data/loki-2.4.7.4/lokisrc/loki_ibd.c:594: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). i=(int)strlen(name); data/loki-2.4.7.4/lokisrc/loki_ibd.c:901: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). dlen=(int)strlen(dname); data/loki-2.4.7.4/lokisrc/loki_ibd.c:929: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). clen=(int)strlen(linkage[link].name); data/loki-2.4.7.4/lokisrc/loki_ibd.c:944:8: [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(fname); data/loki-2.4.7.4/lokisrc/loki_init.c:159: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). size=strlen(marker[i].name)+10; data/loki-2.4.7.4/lokisrc/loki_monitor.c:209:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). j=read(socklist[i],buf1,8); data/loki-2.4.7.4/lokisrc/loki_monitor.c:243:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). j=read(socklist[i],buf,255); data/loki-2.4.7.4/lokisrc/loki_monitor.c:356:8: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). omask=umask(077); data/loki-2.4.7.4/lokisrc/loki_monitor.c:357: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). len=sizeof(sock.sun_family)+strlen(sock.sun_path)+1; data/loki-2.4.7.4/lokisrc/loki_monitor.c:378:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(i>0 && (j=read(s,buf,255))>0) { data/loki-2.4.7.4/lokisrc/loki_monitor.c:389:8: [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(buf); data/loki-2.4.7.4/lokisrc/loki_monitor.c:412:8: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask(omask); data/loki-2.4.7.4/lokisrc/loki_utils.c:39: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). else if(fam_recode.flag==ST_STRING) sz=strlen(fam_recode.recode[fam-1].string); data/loki-2.4.7.4/lokisrc/loki_utils.c:84:8: [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). sz=s?strlen(s):1; data/loki-2.4.7.4/lokisrc/param_lex.c:642:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/loki-2.4.7.4/lokisrc/param_lex.c:813:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(linebuf,yytext,512); data/loki-2.4.7.4/lokisrc/param_lex.c:851:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(linebuf,yytext+1,512); data/loki-2.4.7.4/lokisrc/param_lex.c:890: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). i=strlen(yylval.string); data/loki-2.4.7.4/lokisrc/param_lex.c:900: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). i=strlen(yylval.string); data/loki-2.4.7.4/lokisrc/param_lex.c:1684: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 yy_scan_bytes(yystr,strlen(yystr) ); data/loki-2.4.7.4/lokisrc/param_lex.c:1947:7: [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=strlen(s)+1; data/loki-2.4.7.4/lokisrc/param_parse.c:832: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). # define yystrlen strlen data/loki-2.4.7.4/lokisrc/print_data.c:101: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(!(s=malloc(strlen(filename)+5))) ABT_FUNC(MMsg); data/loki-2.4.7.4/lokisrc/print_data.c:191: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(!(s=malloc(strlen(og->file)+5))) ABT_FUNC(MMsg); data/loki-2.4.7.4/lokisrc/read_binfiles.c:118: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). i=(int)strlen(p); data/loki-2.4.7.4/lokisrc/read_binfiles.c:193:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(*lfile,tmp1,(size_t)i); data/loki-2.4.7.4/lokisrc/read_binfiles.c:200:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(Filter,tmp,(size_t)i); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:161:4: [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). l=strlen(buf); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:169: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). l=strlen(buf); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:202: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). l=strlen(buf); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:215:7: [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). l=strlen(buf1); data/loki-2.4.7.4/lokisrc/read_solar_idfile.c:226:6: [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). l=strlen(buf1); data/loki-2.4.7.4/prepsrc/compat/merlin.c:171:37: [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(!(cols[ncols].name=malloc(3+strlen(p1)))) ABT_FUNC(MMsg); data/loki-2.4.7.4/prepsrc/control_lex.c:1167:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/loki-2.4.7.4/prepsrc/control_lex.c:1371:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(linebuf,yytext,LINEBUFSIZE); data/loki-2.4.7.4/prepsrc/control_lex.c:1388:11: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(linebuf,yytext+1,LINEBUFSIZE); data/loki-2.4.7.4/prepsrc/control_lex.c:2765: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((k=strlen(s))) { data/loki-2.4.7.4/prepsrc/control_parse.c:1177: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). # define yystrlen strlen data/loki-2.4.7.4/prepsrc/control_parse.c:3239: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). if(!(s1=realloc(s1,strlen(s1)+strlen(s2)+1))) ABT_FUNC(MMsg); data/loki-2.4.7.4/prepsrc/control_parse.c:3239:33: [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(!(s1=realloc(s1,strlen(s1)+strlen(s2)+1))) ABT_FUNC(MMsg); data/loki-2.4.7.4/prepsrc/control_parse.c:3242: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). if(!(s1=malloc(strlen(s2)+1))) ABT_FUNC(MMsg); data/loki-2.4.7.4/prepsrc/control_parse.c:3419:9: [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=(int)strlen(p); data/loki-2.4.7.4/prepsrc/control_parse.c:3499:4: [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(sd->name)+4+log((double)(sd->n_elements+1))/log(10.0); data/loki-2.4.7.4/prepsrc/control_parse.c:4211: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(p); data/loki-2.4.7.4/prepsrc/gen_elim.c:1246: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((fname1=malloc(strlen(ErrorDir)+strlen(s)+(fg?7:6)))) data/loki-2.4.7.4/prepsrc/gen_elim.c:1246: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((fname1=malloc(strlen(ErrorDir)+strlen(s)+(fg?7:6)))) data/loki-2.4.7.4/prepsrc/gen_elim.c:1249: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((fname2=malloc(strlen(s)+(fg?6:5)))) { data/loki-2.4.7.4/prepsrc/gen_elim.c:2277:10: [1] (buffer) fscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. i=fscanf(ferr,"%255s %255s %255s %255s",bf3,bf,bf1,bf2); data/loki-2.4.7.4/prepsrc/gen_elim.c:2282:10: [1] (buffer) fscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. i=fscanf(ferr,"%255s %255s %255s",bf,bf1,bf2); data/loki-2.4.7.4/prepsrc/get_marker_name.c:42: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(tbuf)+strlen(mark->var->name)+3; data/loki-2.4.7.4/prepsrc/get_marker_name.c:42: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). i=strlen(tbuf)+strlen(mark->var->name)+3; data/loki-2.4.7.4/prepsrc/get_marker_name.c:46: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(mark->var->name)+1; data/loki-2.4.7.4/prepsrc/read_data.c:191: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(p1)+1; data/loki-2.4.7.4/prepsrc/read_data.c:695:8: [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(fs)>1) { data/loki-2.4.7.4/prepsrc/read_data.c:754:8: [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). l=strlen(buffer); data/loki-2.4.7.4/prepsrc/read_data.c:795:9: [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). l=strlen(buffer); data/loki-2.4.7.4/prepsrc/read_data.c:904: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). string_leng=strlen(string_start); data/loki-2.4.7.4/prepsrc/restrict_data.c:298:32: [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(!(res->arg.string=malloc(strlen(s)+strlen(s1)+1))) ABT_FUNC(MMsg); data/loki-2.4.7.4/prepsrc/restrict_data.c:298:42: [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(!(res->arg.string=malloc(strlen(s)+strlen(s1)+1))) ABT_FUNC(MMsg); data/loki-2.4.7.4/prepsrc/write_data.c:221:7: [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). k+=strlen(ped_recode[i]->data.string); data/loki-2.4.7.4/prepsrc/write_data.c:230:64: [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(family_recode1[i] && family_recode[i]->type==STRING) k1+=strlen(family_recode[i]->data.string)+1; data/loki-2.4.7.4/prepsrc/write_data.c:264:23: [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(linkp->name) k+=strlen(linkp->name)+1; data/loki-2.4.7.4/prepsrc/write_data.c:285:7: [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). k+=strlen(markers[i].var->name)+1; data/loki-2.4.7.4/prepsrc/write_data.c:301: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). for(j=0;j<k;j++) k1+=1+strlen(factor_recode[n_factors+i][j]->data.string); data/loki-2.4.7.4/prepsrc/write_data.c:318:7: [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). k+=strlen(sd->name)+1; data/loki-2.4.7.4/prepsrc/write_data.c:342: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). for(k2=0;k2<k;k2++) k1+=1+strlen(factor_recode[j][k2]->data.string); data/loki-2.4.7.4/prepsrc/write_data.c:360:7: [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). k+=strlen(sd->name)+1; data/loki-2.4.7.4/prepsrc/write_data.c:384: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). for(k2=0;k2<k;k2++) k1+=1+strlen(factor_recode[j][k2]->data.string); data/loki-2.4.7.4/utils/hist.c:52: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). l=strlen(optarg); data/loki-2.4.7.4/utils/hist.c:61: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). l=strlen(optarg); data/loki-2.4.7.4/utils/hist.c:103: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). l=strlen(argv[optind]); data/loki-2.4.7.4/utils/qavg.c:38:6: [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). l=strlen(buf); ANALYSIS SUMMARY: Hits = 269 Lines analyzed = 49204 in approximately 1.47 seconds (33514 lines/second) Physical Source Lines of Code (SLOC) = 42147 Hits@level = [0] 854 [1] 86 [2] 128 [3] 11 [4] 44 [5] 0 Hits@level+ = [0+] 1123 [1+] 269 [2+] 183 [3+] 55 [4+] 44 [5+] 0 Hits/KSLOC@level+ = [0+] 26.6448 [1+] 6.38242 [2+] 4.34195 [3+] 1.30496 [4+] 1.04397 [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.