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/xsnow-3.1.1/src/wind.h Examining data/xsnow-3.1.1/src/clientwin.c Examining data/xsnow-3.1.1/src/fallensnow.h Examining data/xsnow-3.1.1/src/Santa.h Examining data/xsnow-3.1.1/src/windows.c Examining data/xsnow-3.1.1/src/mainstub.cpp Examining data/xsnow-3.1.1/src/docs.h Examining data/xsnow-3.1.1/src/globals.h Examining data/xsnow-3.1.1/src/birds.h Examining data/xsnow-3.1.1/src/flags.c Examining data/xsnow-3.1.1/src/Santa.c Examining data/xsnow-3.1.1/src/flags.h Examining data/xsnow-3.1.1/src/utils.c Examining data/xsnow-3.1.1/src/ui.c Examining data/xsnow-3.1.1/src/clocks.h Examining data/xsnow-3.1.1/src/stars.c Examining data/xsnow-3.1.1/src/mainstub.h Examining data/xsnow-3.1.1/src/treesnow.c Examining data/xsnow-3.1.1/src/pixmaps.c Examining data/xsnow-3.1.1/src/transparent.c Examining data/xsnow-3.1.1/src/dsimple.c Examining data/xsnow-3.1.1/src/fallensnow.c Examining data/xsnow-3.1.1/src/doit.h Examining data/xsnow-3.1.1/src/clientwin.h Examining data/xsnow-3.1.1/src/xsnow.h Examining data/xsnow-3.1.1/src/stars.h Examining data/xsnow-3.1.1/src/docs.c Examining data/xsnow-3.1.1/src/debug.h Examining data/xsnow-3.1.1/src/csvpos.h Examining data/xsnow-3.1.1/src/doitb.h Examining data/xsnow-3.1.1/src/varia.h Examining data/xsnow-3.1.1/src/dsimple.h Examining data/xsnow-3.1.1/src/utils.h Examining data/xsnow-3.1.1/src/version.h Examining data/xsnow-3.1.1/src/blowoff.c Examining data/xsnow-3.1.1/src/meteo.h Examining data/xsnow-3.1.1/src/clocks.c Examining data/xsnow-3.1.1/src/hashtable.cpp Examining data/xsnow-3.1.1/src/snow.h Examining data/xsnow-3.1.1/src/pixmaps.h Examining data/xsnow-3.1.1/src/main.c Examining data/xsnow-3.1.1/src/wmctrl.h Examining data/xsnow-3.1.1/src/loadmeasure.c Examining data/xsnow-3.1.1/src/loadmeasure.h Examining data/xsnow-3.1.1/src/birds.c Examining data/xsnow-3.1.1/src/scenery.h Examining data/xsnow-3.1.1/src/kdtree.c Examining data/xsnow-3.1.1/src/scenery.c Examining data/xsnow-3.1.1/src/hashtable.h Examining data/xsnow-3.1.1/src/ixpm.h Examining data/xsnow-3.1.1/src/ixpm.c Examining data/xsnow-3.1.1/src/snow.c Examining data/xsnow-3.1.1/src/transparent.h Examining data/xsnow-3.1.1/src/meteo.c Examining data/xsnow-3.1.1/src/snow_includes.h Examining data/xsnow-3.1.1/src/csvpos.c Examining data/xsnow-3.1.1/src/kdtree.h Examining data/xsnow-3.1.1/src/windows.h Examining data/xsnow-3.1.1/src/blowoff.h Examining data/xsnow-3.1.1/src/treesnow.h Examining data/xsnow-3.1.1/src/wmctrl.c Examining data/xsnow-3.1.1/src/ui.h Examining data/xsnow-3.1.1/src/wind.c FINAL RESULTS: data/xsnow-3.1.1/src/csvpos.c:60:7: [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,p); data/xsnow-3.1.1/src/debug.h:24:58: [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. #define P(...) do {printf ("%s: %d: ",__FILE__,__LINE__);printf(__VA_ARGS__);fflush(stdout);}while(0) data/xsnow-3.1.1/src/debug.h:28:58: [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. #define R(...) do {printf ("%s: %d: ",__FILE__,__LINE__);printf(__VA_ARGS__);fflush(stdout);} while(0) data/xsnow-3.1.1/src/debug.h:29:70: [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. #define I(...) do {printf ("Xsnow info: %s: %d: ",__FILE__,__LINE__);printf(__VA_ARGS__);fflush(stdout);} while(0) data/xsnow-3.1.1/src/docs.c:328:12: [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). result = strcat(result,haystack); data/xsnow-3.1.1/src/docs.c:335:14: [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). result = strcat(result, rep); data/xsnow-3.1.1/src/dsimple.c:379:4: [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, msg, args); data/xsnow-3.1.1/src/flags.c:326:4: [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(FlagsFile,FLAGSFILE); data/xsnow-3.1.1/src/flags.c:384:4: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(svalue,fmt,value); data/xsnow-3.1.1/src/ixpm.c:329:4: [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(x[2],color); data/xsnow-3.1.1/src/main.c:494:7: [4] (shell) execvp: 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. execvp(Argv[0],Argv); data/xsnow-3.1.1/src/scenery.c:404:4: [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(xpmtmp[2],Flags.TreeColor); data/xsnow-3.1.1/src/utils.c:41:4: [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(*path,home); data/xsnow-3.1.1/src/utils.c:43:4: [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(*path,file); data/xsnow-3.1.1/src/birds.c:366:11: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (drand48() < Flags.Anarchy*0.01) data/xsnow-3.1.1/src/birds.c:463:26: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->sx += bird->sx*p*drand48(); data/xsnow-3.1.1/src/birds.c:464:26: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->sy += bird->sy*p*drand48(); data/xsnow-3.1.1/src/birds.c:465:26: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->sz += bird->sz*p*drand48(); data/xsnow-3.1.1/src/birds.c:468:51: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. normalize_speed(bird,globals.meanspeed*(0.9+drand48()*0.2)); data/xsnow-3.1.1/src/birds.c:710:17: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->x = drand48()*globals.maxx; data/xsnow-3.1.1/src/birds.c:711:17: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->y = drand48()*globals.maxy; data/xsnow-3.1.1/src/birds.c:712:17: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->z = drand48()*globals.maxz; data/xsnow-3.1.1/src/birds.c:714:18: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. double r = drand48(); data/xsnow-3.1.1/src/birds.c:728:23: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->sx = (0.5-drand48()); data/xsnow-3.1.1/src/birds.c:730:23: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->sy = (0.5-drand48()); data/xsnow-3.1.1/src/birds.c:731:23: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->sz = (0.5-drand48()); data/xsnow-3.1.1/src/birds.c:735:25: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. bird->wingstate = drand48()*NWINGS; data/xsnow-3.1.1/src/birds.c:851:7: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. 0.3+drand48()*0.4, data/xsnow-3.1.1/src/birds.c:852:7: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. 0.4+drand48()*0.2, data/xsnow-3.1.1/src/birds.c:853:7: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. 0.3+drand48()*0.4 data/xsnow-3.1.1/src/fallensnow.c:449:13: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. p = drand48(); data/xsnow-3.1.1/src/fallensnow.c:458:44: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. flake->rx = fsnow->x + i + 16*(drand48()-0.5); data/xsnow-3.1.1/src/fallensnow.c:466:32: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (switches.UseGtk && drand48() > 0.25) data/xsnow-3.1.1/src/fallensnow.c:515:37: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (!Flags.NoWind && Wind != 0 && drand48() > 0.5) data/xsnow-3.1.1/src/fallensnow.c:523:57: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. flake->ry = fsnow->y - fsnow->acth[i] - drand48()*8;// randint(MaxSnowFlakeWidth); data/xsnow-3.1.1/src/flags.c:316:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *h = getenv("HOME"); data/xsnow-3.1.1/src/main.c:320: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. if (getenv("WAYLAND_DISPLAY")&&getenv("WAYLAND_DISPLAY")[0]) data/xsnow-3.1.1/src/main.c:320:35: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("WAYLAND_DISPLAY")&&getenv("WAYLAND_DISPLAY")[0]) data/xsnow-3.1.1/src/main.c:363:58: [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 (Flags.DisplayName == NULL) Flags.DisplayName = getenv("DISPLAY"); data/xsnow-3.1.1/src/meteo.c:138:8: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (drand48() > 0.2) return TRUE; data/xsnow-3.1.1/src/scenery.c:295:19: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int flop = (drand48()>0.5); data/xsnow-3.1.1/src/snow.c:380:32: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. (fckill && !flake->cyclic && drand48() > 0.3) || // high probability to remove blown-off flake data/xsnow-3.1.1/src/snow.c:381:14: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. (fckill && drand48() > 0.9) // low probability to remove other flakes data/xsnow-3.1.1/src/snow.c:406:34: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. flake->vy += INITIALYSPEED * (drand48()-0.4)*0.1 ; data/xsnow-3.1.1/src/snow.c:483:54: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. flake->ry = fsnow->y - fsnow->acth[i] - 0.8*drand48()*flakeh; data/xsnow-3.1.1/src/snow.c:573:15: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int p = 1+drand48()*3; data/xsnow-3.1.1/src/snow.c:655:10: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. type = drand48()*NFlakeTypesVintage; data/xsnow-3.1.1/src/snow.c:657:31: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. type = NFlakeTypesVintage + drand48()*(MaxFlakeTypes - NFlakeTypesVintage); data/xsnow-3.1.1/src/snow.c:726:24: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. flake->m = drand48()+0.1; data/xsnow-3.1.1/src/snow.c:733:24: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. flake->wsens = drand48()*MAXWSENS; data/xsnow-3.1.1/src/snow.c:828:7: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (drand48() > p ) data/xsnow-3.1.1/src/snow.c:840:14: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. float a = drand48()*355.0/113.0; data/xsnow-3.1.1/src/snow.c:952:15: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. w = m+m*drand48(); data/xsnow-3.1.1/src/snow.c:953:15: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. h = m+m*drand48(); data/xsnow-3.1.1/src/stars.c:173:11: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (drand48() > 0.8) data/xsnow-3.1.1/src/utils.c:36:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *h = getenv("HOME"); data/xsnow-3.1.1/src/utils.c:99:11: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. return drand48()*m; data/xsnow-3.1.1/src/utils.c:109:14: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. v1 = 2.0 * drand48() - 1.0; data/xsnow-3.1.1/src/utils.c:110:14: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. v2 = 2.0 * drand48() - 1.0; data/xsnow-3.1.1/src/wind.c:121:7: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. r = drand48()*Whirl; data/xsnow-3.1.1/src/wind.c:157:40: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if ((TNow - prevtime) < 2*WindTimer*drand48()) return TRUE; data/xsnow-3.1.1/src/wind.c:161:7: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if(drand48() > 0.65) // Now for some of Rick's magic: data/xsnow-3.1.1/src/wind.c:163:10: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if(drand48() > 0.4) data/xsnow-3.1.1/src/windows.c:384:23: [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. desktopsession = getenv(desktops[i]); data/xsnow-3.1.1/src/Santa.c:171:51: [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. pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)Santas[i][j][k]); data/xsnow-3.1.1/src/Santa.c:176:4: [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 *path[PIXINANIMATION]; data/xsnow-3.1.1/src/Santa.c:241:4: [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 *path[PIXINANIMATION]; data/xsnow-3.1.1/src/Santa.c:304:13: [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 **)Santas[Flags.SantaSize][withRudolf][i], data/xsnow-3.1.1/src/birds.c:833:22: [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. xpm_set_color((char **)birds_xpm[i], &x, &lines, color); data/xsnow-3.1.1/src/csvpos.c:53:4: [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 p[256]; data/xsnow-3.1.1/src/csvpos.c:57:7: [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(p,"%d,",k[i]); data/xsnow-3.1.1/src/flags.c:383:4: [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 svalue[256]; data/xsnow-3.1.1/src/ixpm.c:161:7: [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[100]; data/xsnow-3.1.1/src/ixpm.c:233:7: [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[100]; data/xsnow-3.1.1/src/ixpm.c:328:4: [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(x[2],". c "); data/xsnow-3.1.1/src/kdtree.c:199:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(node->pos, pos, dim * sizeof *node->pos); data/xsnow-3.1.1/src/kdtree.c:664: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(pos, rset->riter->item->pos, rset->tree->dim * sizeof *pos); data/xsnow-3.1.1/src/kdtree.c:732: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(rect->min, min, size); data/xsnow-3.1.1/src/kdtree.c:733: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(rect->max, max, size); data/xsnow-3.1.1/src/main.c:928:4: [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 t[128]; data/xsnow-3.1.1/src/main.c:990:4: [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 msg[1024]; data/xsnow-3.1.1/src/scenery.c:377:38: [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. create_tree_surface(tt,i,(const char **)xpmtrees[tt]); data/xsnow-3.1.1/src/scenery.c:403:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. xpmtmp[2] = (char *)realloc(xpmtmp[2],strlen(xpmtmp[2])+strlen(Flags.TreeColor)+1); data/xsnow-3.1.1/src/snow.c:944:22: [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. xpm_set_color((char **)snow_xpm[i],&x[i],&lines,"snow"); data/xsnow-3.1.1/src/stars.c:42: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 *StarColor[STARANIMATIONS] = { (char *)"gold", (char *)"gold1", data/xsnow-3.1.1/src/ui.c:135: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 sbuffer[nsbuffer]; data/xsnow-3.1.1/src/ui.c:240: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). int santa_type = atoi(s); data/xsnow-3.1.1/src/ui.c:371:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int p = atoi(s); data/xsnow-3.1.1/src/ui.c:446:53: [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. pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)Santas[i/2][i%2][0]); data/xsnow-3.1.1/src/ui.c:458:50: [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. pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)xpmtrees[x]);\ data/xsnow-3.1.1/src/ui.c:479:50: [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. pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)xpmtrees[0]); data/xsnow-3.1.1/src/ui.c:503:4: [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(*s,"#%02lx%02lx%02lx",lrint(c->red*255),lrint(c->green*255),lrint(c->blue*255)); data/xsnow-3.1.1/src/ui.c:576:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int ww = atoi(s); data/xsnow-3.1.1/src/ui.c:715:4: [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(sbuffer,"Click to\nconfirm %d",bct_countdown); data/xsnow-3.1.1/src/ui.c:1185:4: [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 a[20]; data/xsnow-3.1.1/src/ui.c:1186:4: [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(a,"%6d",n); data/xsnow-3.1.1/src/utils.c:44: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). FILE *f = fopen(*path,mode); data/xsnow-3.1.1/src/csvpos.c:54: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). int l = strlen(*s); data/xsnow-3.1.1/src/csvpos.c:58: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). l += strlen(p); data/xsnow-3.1.1/src/docs.c:318: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(needle) == 0) data/xsnow-3.1.1/src/docs.c:327:35: [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). result = (char *)realloc(result,strlen(result)+strlen(haystack)+1); data/xsnow-3.1.1/src/docs.c:327:50: [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). result = (char *)realloc(result,strlen(result)+strlen(haystack)+1); data/xsnow-3.1.1/src/docs.c:333: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). result = (char *)realloc(result,strlen(result)+strlen(haystack)+strlen(rep)+1); data/xsnow-3.1.1/src/docs.c:333: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). result = (char *)realloc(result,strlen(result)+strlen(haystack)+strlen(rep)+1); data/xsnow-3.1.1/src/docs.c:333:69: [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). result = (char *)realloc(result,strlen(result)+strlen(haystack)+strlen(rep)+1); data/xsnow-3.1.1/src/docs.c:334:14: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. result = strncat(result, haystack, q-haystack); data/xsnow-3.1.1/src/docs.c:336: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). haystack = q+strlen(needle); data/xsnow-3.1.1/src/flags.c:324:43: [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). FlagsFile = (char *)realloc (FlagsFile,strlen(FlagsFile) + 1 + strlen(FLAGSFILE) + 1); data/xsnow-3.1.1/src/flags.c:324:67: [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). FlagsFile = (char *)realloc (FlagsFile,strlen(FlagsFile) + 1 + strlen(FLAGSFILE) + 1); data/xsnow-3.1.1/src/flags.c:325:4: [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(FlagsFile,"/"); data/xsnow-3.1.1/src/ixpm.c:66: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). size_t n = strlen(s)/l; data/xsnow-3.1.1/src/ixpm.c:70: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). char *b = s+strlen(s)-l; data/xsnow-3.1.1/src/ixpm.c:73:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(c,a,l); data/xsnow-3.1.1/src/ixpm.c:74:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(a,b,l); data/xsnow-3.1.1/src/ixpm.c:75:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(b,c,l); data/xsnow-3.1.1/src/ixpm.c:163:7: [1] (buffer) sscanf: 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. sscanf(data[i]+n,"%*s %100s",s); data/xsnow-3.1.1/src/ixpm.c:234: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). if (strlen(xpm[i]) > (size_t)cpp + 6) data/xsnow-3.1.1/src/ixpm.c:236:3: [1] (buffer) sscanf: 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. sscanf(xpm[i]+cpp,"%*s %100s",s); data/xsnow-3.1.1/src/ixpm.c:253: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). int l = strlen(s); data/xsnow-3.1.1/src/ixpm.c:277: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). int l = strlen(s); data/xsnow-3.1.1/src/scenery.c:222: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). else if (strlen(Flags.TreeType) == 0) data/xsnow-3.1.1/src/scenery.c:403: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). xpmtmp[2] = (char *)realloc(xpmtmp[2],strlen(xpmtmp[2])+strlen(Flags.TreeColor)+1); data/xsnow-3.1.1/src/scenery.c:403:60: [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). xpmtmp[2] = (char *)realloc(xpmtmp[2],strlen(xpmtmp[2])+strlen(Flags.TreeColor)+1); data/xsnow-3.1.1/src/transparent.c:164:4: [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(200000); // seems to be necessary with nvidia, not sure if this is indeed the case data/xsnow-3.1.1/src/ui.c:239:45: [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). const gchar *s = gtk_widget_get_name(w)+strlen(PREFIX_SANTA); data/xsnow-3.1.1/src/ui.c:241: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). int have_rudolf = ('r' == s[strlen(s)-1]); data/xsnow-3.1.1/src/ui.c:370:45: [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). const gchar *s = gtk_widget_get_name(w)+strlen(PREFIX_TREE); data/xsnow-3.1.1/src/ui.c:575:45: [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). const gchar *s = gtk_widget_get_name(w)+strlen(PREFIX_WW); data/xsnow-3.1.1/src/utils.c:40: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). (*path) = (char *) malloc(strlen(home)+strlen(file)+2); data/xsnow-3.1.1/src/utils.c:40:43: [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). (*path) = (char *) malloc(strlen(home)+strlen(file)+2); data/xsnow-3.1.1/src/utils.c:42:4: [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(*path,"/"); data/xsnow-3.1.1/src/wmctrl.c:468: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). if (strlen(name)>20) ANALYSIS SUMMARY: Hits = 132 Lines analyzed = 13256 in approximately 0.34 seconds (39076 lines/second) Physical Source Lines of Code (SLOC) = 10502 Hits@level = [0] 176 [1] 35 [2] 33 [3] 50 [4] 14 [5] 0 Hits@level+ = [0+] 308 [1+] 132 [2+] 97 [3+] 64 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 29.3277 [1+] 12.569 [2+] 9.23634 [3+] 6.09408 [4+] 1.33308 [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.