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/wmcalc-0.7/wmcalc_err.h
Examining data/wmcalc-0.7/wmcalc_c.h
Examining data/wmcalc-0.7/wmcalc_f.h
Examining data/wmcalc-0.7/wmcalcswitch.c
Examining data/wmcalc-0.7/readln.c
Examining data/wmcalc-0.7/wmcalc_x.h
Examining data/wmcalc-0.7/wmcalc_g.h
Examining data/wmcalc-0.7/wmcalcfunc.c
Examining data/wmcalc-0.7/wmcalc_t.h
Examining data/wmcalc-0.7/wmcalc.c

FINAL RESULTS:

data/wmcalc-0.7/wmcalc.c:111: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(configfile, getenv("HOME"));  /* Added to wmbutton by Casey Harkin, 3/6/99 */
data/wmcalc-0.7/wmcalc.c:112: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(configfile, CONFFILENAME);    /* Fixed Bug - didn't look in home directory */
data/wmcalc-0.7/wmcalc.c:114: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(tempfile, CONFTEMPFILE);      /* Setup name for temp file */
data/wmcalc-0.7/wmcalc.c:129:2:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
	sscanf(argv[i], "%s", Geometry_str);
data/wmcalc-0.7/wmcalc.c:134:2:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
	sscanf(argv[i], "%s", Display_str);
data/wmcalc-0.7/wmcalc.c:142:2:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
	sscanf(argv[i], "%s", configfile);
data/wmcalc-0.7/wmcalcfunc.c:527:7:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  if (system(SysCalcCmd) == -1)
data/wmcalc-0.7/wmcalcswitch.c:408:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(configfile, getenv("HOME"));  /* Added to wmbutton by Gordon Fraser, 9/21/01 */
data/wmcalc-0.7/wmcalcswitch.c:409:5:  [4] (buffer) strcat:
  Does not check for buffer overflows when concatenating to destination
  [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or
  snprintf (warning: strncat is easily misused).
    strcat(configfile, CONFFILENAME);
data/wmcalc-0.7/wmcalcswitch.c:415:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(tempfile, getenv("HOME"));
data/wmcalc-0.7/wmcalcswitch.c:448:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(movefilecmd, "mv -f %s %s\n", tempfile, configfile);
data/wmcalc-0.7/wmcalcswitch.c:449:14:  [4] (shell) system:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
  err_code = system(movefilecmd);
data/wmcalc-0.7/wmcalcswitch.c:487:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(configfile, CONFIGGLOBAL);             /* ...so try to open global config */
data/wmcalc-0.7/wmcalcswitch.c:573:6:  [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(SysCalcCmd, cfg_var_ptr);
data/wmcalc-0.7/wmcalc.c:111: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.
  strcpy(configfile, getenv("HOME"));  /* Added to wmbutton by Casey Harkin, 3/6/99 */
data/wmcalc-0.7/wmcalcswitch.c:408:24:  [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.
    strcpy(configfile, getenv("HOME"));  /* Added to wmbutton by Gordon Fraser, 9/21/01 */
data/wmcalc-0.7/wmcalcswitch.c:415: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.
    strcpy(tempfile, getenv("HOME"));
data/wmcalc-0.7/wmcalc.c:75: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 DispString[DISPSIZE+1];   /* Pointer to string of display */
data/wmcalc-0.7/wmcalc.c:102: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 Geometry_str[64] = "64x64+0+0";
data/wmcalc-0.7/wmcalc.c:103: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 Display_str[64] = "";
data/wmcalc-0.7/wmcalc.c:107: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[20];
data/wmcalc-0.7/wmcalc_g.h:33: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 configfile[CONFIGFILEMAX];
data/wmcalc-0.7/wmcalc_g.h:34: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 tempfile[CONFIGFILEMAX];
data/wmcalc-0.7/wmcalc_g.h:43: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 *CfgVarList[MAX_LABEL] = {"Mem0",
data/wmcalc-0.7/wmcalc_g.h:67: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 SysCalcCmd[CALC_CMD_SIZE] = "xcalc &";
data/wmcalc-0.7/wmcalcfunc.c:179:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(DispString, "%10.5g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:207:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(DispString, "%10.5g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:235: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(DispString, "%10.5g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:240: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(DispString, "%10.4g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:388: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(DispString, "%10.10g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:392: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(DispString, "%10.10g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:396: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(DispString, "%10.10g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:400: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(DispString, "%10.10g", RegisterA);
data/wmcalc-0.7/wmcalcfunc.c:501:3:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  sprintf(DispString, "%10.5g", RegisterA);
data/wmcalc-0.7/wmcalcswitch.c:398: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 movefilecmd[2 * CONFIGFILEMAX + 10];  /* make sure enough room in string */
data/wmcalc-0.7/wmcalcswitch.c:401: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 ((fp = fopen(configfile, "r")) == NULL) {  /* Can't find config file */
data/wmcalc-0.7/wmcalcswitch.c:413:16:  [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 ((fptmp = fopen(tempfile, "w")) == NULL) {  /* Can't open file in /tmp */
data/wmcalc-0.7/wmcalcswitch.c:416:5:  [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(tempfile, "wmcalc.tmp");
data/wmcalc-0.7/wmcalcswitch.c:417: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 ((fptmp = fopen(tempfile, "w")) == NULL) {  /* Can't open file in HOME */
data/wmcalc-0.7/wmcalcswitch.c:430:17:  [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).
      mem_ndx = atoi(line+strlen(CfgVarList[MEM_LABEL_0])-1);
data/wmcalc-0.7/wmcalcswitch.c:486: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 ((fp = fopen(configfile, "r")) == NULL) {    /* Can't find config file */
data/wmcalc-0.7/wmcalcswitch.c:488:15:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((fp = fopen(configfile, "r")) == NULL) {  /* Can't find global config file */
data/wmcalc-0.7/readln.c:45: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).
    count += strlen(t1);
data/wmcalc-0.7/readln.c:55:24:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  if((t2 = realloc(tmp,strlen(tmp)+1)) == NULL)free(tmp);
data/wmcalc-0.7/wmcalcswitch.c:427: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).
		 strlen(CfgVarList[MEM_LABEL_0]) - 1) == 0)) {
data/wmcalc-0.7/wmcalcswitch.c:430:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      mem_ndx = atoi(line+strlen(CfgVarList[MEM_LABEL_0])-1);
data/wmcalc-0.7/wmcalcswitch.c:510:40:  [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).
	while (((strncmp(line, CfgVarList[i], strlen(CfgVarList[i]))) != 0)

ANALYSIS SUMMARY:

Hits = 47
Lines analyzed = 2402 in approximately 0.08 seconds (28445 lines/second)
Physical Source Lines of Code (SLOC) = 1539
Hits@level = [0]  83 [1]   5 [2]  25 [3]   3 [4]  14 [5]   0
Hits@level+ = [0+] 130 [1+]  47 [2+]  42 [3+]  17 [4+]  14 [5+]   0
Hits/KSLOC@level+ = [0+] 84.4704 [1+] 30.5393 [2+] 27.2904 [3+] 11.0461 [4+] 9.09682 [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.