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/bibtool-2.68+ds/BibTcl/bibtool.c Examining data/bibtool-2.68+ds/check.c Examining data/bibtool-2.68+ds/config.h Examining data/bibtool-2.68+ds/crossref.c Examining data/bibtool-2.68+ds/database.c Examining data/bibtool-2.68+ds/entry.c Examining data/bibtool-2.68+ds/error.c Examining data/bibtool-2.68+ds/expand.c Examining data/bibtool-2.68+ds/include/bibtool/bibtool.h Examining data/bibtool-2.68+ds/include/bibtool/check.h Examining data/bibtool-2.68+ds/include/bibtool/crossref.h Examining data/bibtool-2.68+ds/include/bibtool/database.h Examining data/bibtool-2.68+ds/include/bibtool/entry.h Examining data/bibtool-2.68+ds/include/bibtool/error.h Examining data/bibtool-2.68+ds/include/bibtool/expand.h Examining data/bibtool-2.68+ds/include/bibtool/general.h Examining data/bibtool-2.68+ds/include/bibtool/init.h Examining data/bibtool-2.68+ds/include/bibtool/io.h Examining data/bibtool-2.68+ds/include/bibtool/key.h Examining data/bibtool-2.68+ds/include/bibtool/keynode.h Examining data/bibtool-2.68+ds/include/bibtool/macros.h Examining data/bibtool-2.68+ds/include/bibtool/names.h Examining data/bibtool-2.68+ds/include/bibtool/parse.h Examining data/bibtool-2.68+ds/include/bibtool/print.h Examining data/bibtool-2.68+ds/include/bibtool/pxfile.h Examining data/bibtool-2.68+ds/include/bibtool/record.h Examining data/bibtool-2.68+ds/include/bibtool/regex.h Examining data/bibtool-2.68+ds/include/bibtool/resource.h Examining data/bibtool-2.68+ds/include/bibtool/rewrite.h Examining data/bibtool-2.68+ds/include/bibtool/rsc.h Examining data/bibtool-2.68+ds/include/bibtool/s_parse.h Examining data/bibtool-2.68+ds/include/bibtool/sbuffer.h Examining data/bibtool-2.68+ds/include/bibtool/stack.h Examining data/bibtool-2.68+ds/include/bibtool/symbols.h Examining data/bibtool-2.68+ds/include/bibtool/tex_aux.h Examining data/bibtool-2.68+ds/include/bibtool/tex_read.h Examining data/bibtool-2.68+ds/include/bibtool/type.h Examining data/bibtool-2.68+ds/include/bibtool/version.h Examining data/bibtool-2.68+ds/include/bibtool/wordlist.h Examining data/bibtool-2.68+ds/io.c Examining data/bibtool-2.68+ds/key.c Examining data/bibtool-2.68+ds/macros.c Examining data/bibtool-2.68+ds/main.c Examining data/bibtool-2.68+ds/names.c Examining data/bibtool-2.68+ds/parse.c Examining data/bibtool-2.68+ds/print.c Examining data/bibtool-2.68+ds/pxfile.c Examining data/bibtool-2.68+ds/record.c Examining data/bibtool-2.68+ds/rewrite.c Examining data/bibtool-2.68+ds/rsc.c Examining data/bibtool-2.68+ds/s_parse.c Examining data/bibtool-2.68+ds/sbuffer.c Examining data/bibtool-2.68+ds/stack.c Examining data/bibtool-2.68+ds/symbols.c Examining data/bibtool-2.68+ds/tex_aux.c Examining data/bibtool-2.68+ds/tex_read.c Examining data/bibtool-2.68+ds/type.c Examining data/bibtool-2.68+ds/version.c Examining data/bibtool-2.68+ds/wordlist.c Examining data/bibtool-2.68+ds/init.c FINAL RESULTS: data/bibtool-2.68+ds/names.c:845:3: [5] (buffer) gets: Does not check for buffer overflows (CWE-120, CWE-20). Use fgets() instead. gets(s); /* */ data/bibtool-2.68+ds/names.c:849:11: [5] (buffer) gets: Does not check for buffer overflows (CWE-120, CWE-20). Use fgets() instead. while ( gets(s) ) /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:165:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. { sprintf(buffer,"%s/=%d=",s_db,i++); /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:169: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(name,buffer); /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:194: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(buffer,name); /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:235: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(name,buffer); /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:378:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. { sprintf(buffer, /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:1241: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(s,argv[1]); data/bibtool-2.68+ds/BibTcl/bibtool.c:1243: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(s,argv[2]); data/bibtool-2.68+ds/error.c:94:9: [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. (void)fprintf(err_file, /* */ data/bibtool-2.68+ds/include/bibtool/error.h:240:22: [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 Err(S) (void)fprintf(err_file,err_format,S) data/bibtool-2.68+ds/include/bibtool/error.h:275:30: [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 ErrPrintF(F,A) (void)fprintf(err_file,F,A) data/bibtool-2.68+ds/include/bibtool/error.h:289:33: [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 ErrPrintF2(F,A,B) (void)fprintf(err_file,F,A,B) data/bibtool-2.68+ds/include/bibtool/error.h:304:35: [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 ErrPrintF3(F,A,B,C) (void)fprintf(err_file,F,A,B,C) data/bibtool-2.68+ds/include/bibtool/error.h:421:32: [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 DebugPrintF1(A) (void)fprintf(err_file,A) data/bibtool-2.68+ds/include/bibtool/error.h:435:33: [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 DebugPrintF2(F,A) (void)fprintf(err_file,F,A) data/bibtool-2.68+ds/include/bibtool/error.h:451:35: [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 DebugPrintF3(F,A,B) (void)fprintf(err_file,F,A,B) data/bibtool-2.68+ds/include/bibtool/general.h:45:6: [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. int fprintf(FILE*,char*, ...); data/bibtool-2.68+ds/include/bibtool/general.h:46:6: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. int printf(char*, ...); data/bibtool-2.68+ds/macros.c:249:15: [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. { (void)fprintf(file, /* */ data/bibtool-2.68+ds/macros.c:256:15: [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. { (void)fprintf(file, /* */ data/bibtool-2.68+ds/main.c:764:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. (void)sprintf((char*)t, /* */ data/bibtool-2.68+ds/names.c:157:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(err_file, /* */ data/bibtool-2.68+ds/names.c:224:22: [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). #define UseBuffer(S) strcpy(buffer,S); s = buffer data/bibtool-2.68+ds/pxfile.c:219:13: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. { (void)sprintf(px_filename,*fmt,*pp,name); /* construct new filename */ data/bibtool-2.68+ds/rewrite.c:1083: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((char*)t, (char*)rsc_sel_fields); /* */ data/bibtool-2.68+ds/rewrite.c:1085: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((char*)t, (char*)s); /* */ data/bibtool-2.68+ds/rsc.c:159:13: [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(fn, ap); /* */ data/bibtool-2.68+ds/rsc.c:160:13: [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(fn, DIR_SEP); /* */ data/bibtool-2.68+ds/rsc.c:161:13: [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(fn, (char*)def); /* */ data/bibtool-2.68+ds/symbols.c:168: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(t, s); /* */ data/bibtool-2.68+ds/tex_read.c:970: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(t,s); return(t); /* */ data/bibtool-2.68+ds/include/bibtool/general.h:64:18: [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/bibtool-2.68+ds/init.c:78: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. { char *emtexdir = getenv(EMTEXDIR); /* */ data/bibtool-2.68+ds/key.c:2353:18: [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. { s = (String)getenv("HOSTNAME"); /* */ data/bibtool-2.68+ds/key.c:2392:18: [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. { s = (String)getenv("USER"); /* */ data/bibtool-2.68+ds/main.c:105: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. char * getenv _ARG((char *name)); /* main.c */ data/bibtool-2.68+ds/main.c:110:8: [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 * getenv(name) /* */ data/bibtool-2.68+ds/parse.c:160:13: [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 ((cp = getenv(env)) != NULL) /* */ data/bibtool-2.68+ds/pxfile.c:48:16: [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 _ARG((char* name)); /* */ data/bibtool-2.68+ds/pxfile.c:345:15: [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. { env = getenv(env); /* */ data/bibtool-2.68+ds/pxfile.c:353:20: [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 * env = getenv(HOME_ENV_VAR); /* */ data/bibtool-2.68+ds/rsc.c:78:16: [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 _ARG((char* name)); /* */ data/bibtool-2.68+ds/rsc.c:149: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. if ( (ap=getenv(RSC_ENV_VAR)) != NULL /* Try to get the name */ data/bibtool-2.68+ds/rsc.c:154: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. if ( (ap=getenv(HOME_ENV_VAR)) != NULL ) /* Try to get the resource*/ data/bibtool-2.68+ds/BibTcl/bibtool.c:40: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 buffer[MAX_HANDLE_LENGTH]; data/bibtool-2.68+ds/BibTcl/bibtool.c:231: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(buffer,"=BibTcl=%d=",i++); /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:995:5: [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 buffer[32]; /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:1017: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(buffer,"%d",i); /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:1242: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(s,"={"); data/bibtool-2.68+ds/BibTcl/bibtool.c:1755:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char q[2]; /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:1895: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 ( (file=fopen(argv[3],mode))==NULL ) /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:2070: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(buffer,"%d",Var); Tcl_SetResult(interp,buffer,TCL_VOLATILE);\ data/bibtool-2.68+ds/BibTcl/bibtool.c:2103:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. { static char *av[MAXARGS]; /* */ data/bibtool-2.68+ds/key.c:379:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. { static char buffer[ITOA_LEN]; /* buffer to store result */ data/bibtool-2.68+ds/key.c:2287:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buffer[32]; /* */ data/bibtool-2.68+ds/macros.c:238: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 ( (file=fopen(fname,"w")) == NULL ) /* */ data/bibtool-2.68+ds/main.c:319: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). (file=fopen(m_file,"w")) == NULL) /* */ data/bibtool-2.68+ds/main.c:365:18: [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 ((file=fopen((char*)SymbolValue(o_file),"w")) == NULL)/* */ data/bibtool-2.68+ds/main.c:435:27: [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). case 'D': kpathsea_debug=atoi(++ap); break;/* kpathsea debugging */ data/bibtool-2.68+ds/names.c:223:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[256]; /* */ data/bibtool-2.68+ds/parse.c:261: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). file = fopen((char*)filename, "r"); /* */ data/bibtool-2.68+ds/parse.c:732:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[32]; /* */ data/bibtool-2.68+ds/parse.c:769:15: [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(buffer,"%ld",ignored); /* */ data/bibtool-2.68+ds/pxfile.c:115:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. { static char *absolut_path[2]; /* */ data/bibtool-2.68+ds/pxfile.c:222: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). (file=fopen(px_filename,mode)) != NULL )/* and open succeeds */ data/bibtool-2.68+ds/pxfile.c:298: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(cp,s,l); /* save the string spec */ data/bibtool-2.68+ds/rewrite.c:1084:9: [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. (void)strcat((char*)t, " \""); /* */ data/bibtool-2.68+ds/rewrite.c:1099: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 s_class[256]; /* */ data/bibtool-2.68+ds/rsc.c:298:29: [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). if ( name == S ) { SETQ(V,atoi((char*)SymbolValue(val))); \ data/bibtool-2.68+ds/tex_aux.c:173: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 ( (file=fopen((char*)fname,"r") ) == NULL ) /* */ data/bibtool-2.68+ds/tex_aux.c:177: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). file = fopen(sbflush(sb),"r"); /* */ data/bibtool-2.68+ds/tex_read.c:986:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[1024]; /* */ data/bibtool-2.68+ds/tex_read.c:1005:18: [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 ( (file = fopen(argv[1],"r")) == NULL ) /* */ data/bibtool-2.68+ds/tex_read.c:1017: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). (file = fopen(argv[2],"r")) == NULL ) /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:168: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 ( (name = malloc(strlen(buffer)+1)) == NULL ) return empty;/* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:192: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(name) >= MAX_HANDLE_LENGTH ) /* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:234: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 ( (name = malloc(strlen(buffer)+1)) == NULL ) return empty;/* */ data/bibtool-2.68+ds/BibTcl/bibtool.c:1240: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). s = malloc(strlen(argv[1])+strlen(argv[2])+4); data/bibtool-2.68+ds/BibTcl/bibtool.c:1240: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). s = malloc(strlen(argv[1])+strlen(argv[2])+4); data/bibtool-2.68+ds/BibTcl/bibtool.c:1244:3: [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(s,"}"); data/bibtool-2.68+ds/error.c:172: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 (line[strlen((char*)line)-1] != '\n') ErrNL;/* */ data/bibtool-2.68+ds/include/bibtool/symbols.h:104: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 symlen(SYM) strlen((char*)SymbolValue(SYM)) data/bibtool-2.68+ds/key.c:384: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). base = strlen(digits); /* how many digits? */ data/bibtool-2.68+ds/key.c:513:15: [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). brace = 8 * strlen((char*)line); /* */ data/bibtool-2.68+ds/print.c:276: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). len = strlen((char*)s); /* */ data/bibtool-2.68+ds/pxfile.c:153:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void)strncpy(absolut_path[0],name,l); /* save directory name */ data/bibtool-2.68+ds/pxfile.c:197: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). { len = strlen(*fmt); /* pattern */ data/bibtool-2.68+ds/pxfile.c:200:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). plen += 1+strlen(name); /* add length of name */ data/bibtool-2.68+ds/pxfile.c:208: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). { len = strlen(*pp) + plen; /* required space */ data/bibtool-2.68+ds/rewrite.c:553:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen((char*)val); /* */ data/bibtool-2.68+ds/rewrite.c:625: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). len = strlen((char*)val); /* and its length */ data/bibtool-2.68+ds/rewrite.c:1078: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). { String t = malloc( (size_t)strlen((char*)s) /* */ data/bibtool-2.68+ds/rewrite.c:1079: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). + (size_t)strlen((char*)rsc_sel_fields)/* */ data/bibtool-2.68+ds/rewrite.c:1086:9: [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. (void)strcat((char*)t, "\""); /* */ data/bibtool-2.68+ds/rsc.c:155: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). { len = strlen(ap) + /* */ data/bibtool-2.68+ds/rsc.c:156: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). strlen(DIR_SEP) + /* */ data/bibtool-2.68+ds/rsc.c:157: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). strlen((char*)def) + 1; /* file from the home */ data/bibtool-2.68+ds/symbols.c:166: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). if ( (t=malloc((size_t)strlen(s) + 1)) == NULL ) /* */ data/bibtool-2.68+ds/tex_aux.c:194:12: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (c = getc(file); c != EOF; c = getc(file)) /* */ data/bibtool-2.68+ds/tex_aux.c:194:38: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (c = getc(file); c != EOF; c = getc(file)) /* */ data/bibtool-2.68+ds/tex_aux.c:196:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { for (c = getc(file); /* */ data/bibtool-2.68+ds/tex_aux.c:198:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(file)) /* */ data/bibtool-2.68+ds/tex_aux.c:205:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { switch (c=getc(file)) /* */ data/bibtool-2.68+ds/tex_aux.c:219:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { c = getc(file); /* Save a bib file name */ data/bibtool-2.68+ds/tex_aux.c:222:8: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { c = getc(file); /* */ data/bibtool-2.68+ds/tex_aux.c:233:19: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { while ((c=getc(file)) != '}' && c != EOF) /* */ data/bibtool-2.68+ds/tex_read.c:791:10: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). { return getc(src_file); /* */ data/bibtool-2.68+ds/tex_read.c:968: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 ( (t=malloc(strlen(s)+1)) == NULL ) /* */ ANALYSIS SUMMARY: Hits = 109 Lines analyzed = 21614 in approximately 0.71 seconds (30587 lines/second) Physical Source Lines of Code (SLOC) = 11808 Hits@level = [0] 18 [1] 34 [2] 30 [3] 13 [4] 30 [5] 2 Hits@level+ = [0+] 127 [1+] 109 [2+] 75 [3+] 45 [4+] 32 [5+] 2 Hits/KSLOC@level+ = [0+] 10.7554 [1+] 9.23103 [2+] 6.35163 [3+] 3.81098 [4+] 2.71003 [5+] 0.169377 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.