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/ygl-4.2e/misc.c
Examining data/ygl-4.2e/color.c
Examining data/ygl-4.2e/gl2ppm.c
Examining data/ygl-4.2e/X11/Ygl.h
Examining data/ygl-4.2e/X11/Yfgl.h
Examining data/ygl-4.2e/font.c
Examining data/ygl-4.2e/ygl.c
Examining data/ygl-4.2e/config.h
Examining data/ygl-4.2e/contrib/ycpu.c
Examining data/ygl-4.2e/contrib/xmap.c
Examining data/ygl-4.2e/contrib/yup.c
Examining data/ygl-4.2e/header.h
Examining data/ygl-4.2e/draw.c
Examining data/ygl-4.2e/xmap.c
Examining data/ygl-4.2e/queue.c
Examining data/ygl-4.2e/menu.c
Examining data/ygl-4.2e/makeYgltypes.c
Examining data/ygl-4.2e/3d.c
Examining data/ygl-4.2e/fortran.c
Examining data/ygl-4.2e/examples/popup.c
Examining data/ygl-4.2e/examples/rgbtest.c
Examining data/ygl-4.2e/examples/lmbind.c
Examining data/ygl-4.2e/examples/lines.c
Examining data/ygl-4.2e/examples/coltest.c
Examining data/ygl-4.2e/examples/smile.c

FINAL RESULTS:

data/ygl-4.2e/contrib/xmap.c:73:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(header, "%s, %d bpp", version, p);
data/ygl-4.2e/contrib/ycpu.c:59:27:  [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(NULL == (p = (FILE*) popen(cmd, "r"))) {
data/ygl-4.2e/contrib/yup.c:22:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(cmd, "rup %s", argc == 1 ? "localhost" : argv[1]);
data/ygl-4.2e/contrib/yup.c:34:17:  [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.
    p = (FILE*) popen(cmd, "r");
data/ygl-4.2e/examples/lines.c:51:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(buf2, "Lines drawn with %s",buf1);
data/ygl-4.2e/gl2ppm.c:114:56:  [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.
  tn = (fname[0] != '|') ? fopen(fname, "w") : (FILE*) popen((char*)fname+1, "w");
data/ygl-4.2e/header.h:236:3:  [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.
  vfprintf(stderr, format, Argp);
data/ygl-4.2e/menu.c:217: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(next->name, buf);
data/ygl-4.2e/xmap.c:74:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(header, "%s, %d bpp", version, p);
data/ygl-4.2e/ygl.c:520: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.
  r += vfprintf(stderr, format, Argp);
data/ygl-4.2e/ygl.c:626:17:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
      if((env = getenv(names[v][i])) != NULL && env[0] != '\0') {
data/ygl-4.2e/3d.c:463: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(material, &Materialdefault, sizeof(struct Material));
data/ygl-4.2e/3d.c:579: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(lightmodel, &LightModeldefault, sizeof(struct LightModel));
data/ygl-4.2e/3d.c:681: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(light, &Lightdefault, sizeof(struct Light));
data/ygl-4.2e/contrib/xmap.c:41: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 version[20], header[80], buf[80], *name = argv[0], *title, 
data/ygl-4.2e/contrib/xmap.c:102:2:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
	sprintf(buf, "%d=(%d,%d,%d)", index, r, g, b);
data/ygl-4.2e/contrib/ycpu.c:39: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 hostname[256], cmd[128];
data/ygl-4.2e/contrib/ycpu.c:44:22:  [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(argc > 1) X   = atoi(argv[1]);
data/ygl-4.2e/contrib/ycpu.c:45:22:  [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(argc > 2) sec = atoi(argv[2]);
data/ygl-4.2e/contrib/ycpu.c:57: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(cmd, "vmstat %d", sec);
data/ygl-4.2e/contrib/ycpu.c:67: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 line[160];
data/ygl-4.2e/contrib/yup.c:20: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 cmd[80];
data/ygl-4.2e/contrib/yup.c:33: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 x[80];
data/ygl-4.2e/draw.c:318: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(no[vi], v, sizeof(no[0]));
data/ygl-4.2e/examples/lines.c:47: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 buf1[20], buf2[80];
data/ygl-4.2e/examples/lmbind.c:79:15:  [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).
    nsphere = atoi(argv[1]);
data/ygl-4.2e/examples/rgbtest.c:101: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[80];
data/ygl-4.2e/examples/rgbtest.c:111:2:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
	sprintf(buf,"Color at (%d,%d) is (%d,%d,%d).",x,y,r,g,b);
data/ygl-4.2e/fortran.c:26: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 Tbuf[L_TBUF+1];
data/ygl-4.2e/gl2ppm.c:114:28:  [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).
  tn = (fname[0] != '|') ? fopen(fname, "w") : (FILE*) popen((char*)fname+1, "w");
data/ygl-4.2e/menu.c:127: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 buf[1024], *bufp = buf;
data/ygl-4.2e/menu.c:485: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(m->item[0]->name, "Menu %d", mid);
data/ygl-4.2e/misc.c:78: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 errortext[1024];
data/ygl-4.2e/misc.c:378: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 keys[32];
data/ygl-4.2e/misc.c:614: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 	dashes[17];
data/ygl-4.2e/queue.c:31: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 IsQueued[MAXYGLDEVICE];
data/ygl-4.2e/xmap.c:42: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 version[20], header[80], buf[80], *name = argv[0], *title, 
data/ygl-4.2e/xmap.c:103:2:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
	sprintf(buf, "%d=(%d,%d,%d)", index, r, g, b);
data/ygl-4.2e/ygl.c:309:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    unsigned char wieoft[MAXYGLDEVICE];
data/ygl-4.2e/ygl.c:567: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 errortext[1024];
data/ygl-4.2e/ygl.c:610: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.
  const char *names[NUMVARS][2] = { /* valid names of environment vars */
data/ygl-4.2e/ygl.c:1202: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(&Ygl.RV, xv, sizeof(XVisualInfo));
data/ygl-4.2e/ygl.c:1211: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(&Ygl.CV, xv, sizeof(XVisualInfo));
data/ygl-4.2e/ygl.c:1217: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(&Ygl.CV, &Ygl.RV, sizeof(XVisualInfo));
data/ygl-4.2e/ygl.c:1311: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(&Ygl.CV, xv+i, sizeof(XVisualInfo));
data/ygl-4.2e/ygl.c:1330: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(&Ygl.RV, xv+i, sizeof(XVisualInfo));
data/ygl-4.2e/ygl.c:1368: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(&tmp, &Ygl, sizeof(Ygl)); /* Save a copy of fresh struct */
data/ygl-4.2e/examples/coltest.c:68:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(100000); /* Too short sleeps may stress your XServer... */
data/ygl-4.2e/font.c:136:52:  [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 XTextWidth(Ygl.Fonts[W->font].fs, string, strlen(string));
data/ygl-4.2e/font.c:146: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).
	glCallLists(strlen(Text), GL_UNSIGNED_BYTE, (GLubyte *)Text);
data/ygl-4.2e/font.c:153: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).
		    Text, strlen(Text))
data/ygl-4.2e/fortran.c:29:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(Tbuf, str, l);
data/ygl-4.2e/fortran.c:210:81:  [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).
INT4 YGL_PRE(gversi_)(CHAR*x1, INT4*len) { INT4 r = gversion(x1);if(len) *len = strlen(x1);return r;}
data/ygl-4.2e/fortran.c:247:88:  [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).
void YGL_PRE(getfontencoding_)(CHAR*x1, INT4*len) { getfontencoding(x1);if(len) *len = strlen(x1);} /* > 6 */
data/ygl-4.2e/fortran.c:465:33:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
void YGL_PRE(usleep_)(INT4*x1) {usleep(*x1);}
data/ygl-4.2e/menu.c:212:44:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    if(NULL == (next->name = (char*)malloc(strlen(buf) + 1))) {
data/ygl-4.2e/menu.c:219: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).
    if (strlen(next->name) > strlen(m->longest->name)) m->longest = next;
data/ygl-4.2e/menu.c:219:30:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    if (strlen(next->name) > strlen(m->longest->name)) m->longest = next;
data/ygl-4.2e/menu.c:268:20:  [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).
	      item->name, strlen(item->name));
data/ygl-4.2e/menu.c:344: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).
	      m->item[0]->name, strlen(m->item[0]->name));
data/ygl-4.2e/misc.c:273: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).
      && (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0');
data/ygl-4.2e/misc.c:273:48:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
      && (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0');
data/ygl-4.2e/misc.c:1057:17:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
USLEEP_RET_TYPE usleep(USLEEP_ARG_TYPE Useconds) {
data/ygl-4.2e/ygl.c:1390:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(v, version, 12);

ANALYSIS SUMMARY:

Hits = 64
Lines analyzed = 10466 in approximately 0.33 seconds (31647 lines/second)
Physical Source Lines of Code (SLOC) = 8725
Hits@level = [0] 144 [1]  17 [2]  36 [3]   1 [4]  10 [5]   0
Hits@level+ = [0+] 208 [1+]  64 [2+]  47 [3+]  11 [4+]  10 [5+]   0
Hits/KSLOC@level+ = [0+] 23.8395 [1+] 7.33524 [2+] 5.38682 [3+] 1.26074 [4+] 1.14613 [5+]   0
Symlinks skipped = 5 (--allowlink overrides but see doc for security issue)
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.