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/modules-4.6.1/compat/ModuleCmd_Display.c Examining data/modules-4.6.1/compat/cmdXResource.c Examining data/modules-4.6.1/compat/cmdModule.c Examining data/modules-4.6.1/compat/ModuleCmd_Switch.c Examining data/modules-4.6.1/compat/cmdUname.c Examining data/modules-4.6.1/compat/cmdIsLoaded.c Examining data/modules-4.6.1/compat/ModuleCmd_Purge.c Examining data/modules-4.6.1/compat/cmdUlvl.c Examining data/modules-4.6.1/compat/ModuleCmd_Help.c Examining data/modules-4.6.1/compat/cmdLog.c Examining data/modules-4.6.1/compat/cmdChdir.c Examining data/modules-4.6.1/compat/error.c Examining data/modules-4.6.1/compat/ModuleCmd_Update.c Examining data/modules-4.6.1/compat/utility.c Examining data/modules-4.6.1/compat/ModuleCmd_Init.c Examining data/modules-4.6.1/compat/cmdWhatis.c Examining data/modules-4.6.1/compat/ModuleCmd_Avail.c Examining data/modules-4.6.1/compat/ModuleCmd_Clear.c Examining data/modules-4.6.1/compat/cmdConflict.c Examining data/modules-4.6.1/compat/init.c Examining data/modules-4.6.1/compat/ModuleCmd_Whatis.c Examining data/modules-4.6.1/compat/cmdVerbose.c Examining data/modules-4.6.1/compat/locate_module.c Examining data/modules-4.6.1/compat/cmdVersion.c Examining data/modules-4.6.1/compat/cmdTrace.c Examining data/modules-4.6.1/compat/cmdInfo.c Examining data/modules-4.6.1/compat/ModuleCmd_List.c Examining data/modules-4.6.1/compat/cmdPath.c Examining data/modules-4.6.1/compat/cmdMisc.c Examining data/modules-4.6.1/compat/getopt.c Examining data/modules-4.6.1/compat/cmdAlias.c Examining data/modules-4.6.1/compat/main.c Examining data/modules-4.6.1/compat/modules_def.h Examining data/modules-4.6.1/compat/ModuleCmd_Refresh.c Examining data/modules-4.6.1/compat/ModuleCmd_Use.c Examining data/modules-4.6.1/compat/ModuleCmd_Load.c Examining data/modules-4.6.1/compat/version.c Examining data/modules-4.6.1/compat/getopt.h Examining data/modules-4.6.1/compat/cmdSetenv.c Examining data/modules-4.6.1/lib/testutil-getgrgid.c Examining data/modules-4.6.1/lib/testutil-mktime.c Examining data/modules-4.6.1/lib/testutil-closedir.c Examining data/modules-4.6.1/lib/testutil-0getgroups.c Examining data/modules-4.6.1/lib/testutil-dupgetgroups.c Examining data/modules-4.6.1/lib/testutil-getgroups.c Examining data/modules-4.6.1/lib/envmodules.h Examining data/modules-4.6.1/lib/envmodules.c Examining data/modules-4.6.1/lib/testutil-getpwuid.c Examining data/modules-4.6.1/lib/testutil-time.c FINAL RESULTS: data/modules-4.6.1/compat/ModuleCmd_Avail.c:662:10: [4] (buffer) fscanf: 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. if( fscanf( cdir, "%s %d\n", buf, (int *)&info_time) != 2) data/modules-4.6.1/compat/ModuleCmd_Avail.c:1388:14: [4] (buffer) fscanf: 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. if( 1 != fscanf( cacheinput, "%s", buf)) data/modules-4.6.1/compat/ModuleCmd_Avail.c:1430:11: [4] (buffer) fscanf: 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. if( 1 != fscanf( cacheinput, "%s", buf)) { data/modules-4.6.1/compat/ModuleCmd_Avail.c:1695:4: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf( _file_list_buffer, short_format_full, data/modules-4.6.1/compat/ModuleCmd_Avail.c:1699:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf( _file_list_buffer, short_format_full, data/modules-4.6.1/compat/ModuleCmd_Avail.c:1703:6: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf( _file_list_buffer, data/modules-4.6.1/compat/ModuleCmd_Avail.c:1707:6: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf( _file_list_buffer, data/modules-4.6.1/compat/ModuleCmd_Avail.c:1737: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( stderr, long_format, module, symbols, data/modules-4.6.1/compat/ModuleCmd_Avail.c:2056:10: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). return( strcpy( dirbuf, file)); data/modules-4.6.1/compat/ModuleCmd_Avail.c:2072: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( dirbuf, dir); data/modules-4.6.1/compat/ModuleCmd_Avail.c:2075: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). return( strcat( dirbuf, file)); data/modules-4.6.1/compat/cmdInfo.c:339: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( buf, s); data/modules-4.6.1/compat/cmdInfo.c:341:6: [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( buf, t); data/modules-4.6.1/compat/cmdInfo.c:370: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( buf, s); data/modules-4.6.1/compat/cmdInfo.c:372: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( buf, t); data/modules-4.6.1/compat/cmdInfo.c:375: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( buf, s); data/modules-4.6.1/compat/cmdLog.c:171:2: [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( &faclist[save_len + 1], argv[ i]); data/modules-4.6.1/compat/cmdLog.c:195: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( t, s); data/modules-4.6.1/compat/cmdMisc.c:166:9: [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. i = system( buf); data/modules-4.6.1/compat/cmdModule.c:818: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( cmdline, procname); data/modules-4.6.1/compat/cmdPath.c:308:2: [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( newpath, qualifiedpath); data/modules-4.6.1/compat/cmdPath.c:325:2: [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( newpath, oldpath); data/modules-4.6.1/compat/cmdPath.c:338: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(newpath, oldpath); data/modules-4.6.1/compat/cmdPath.c:343: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(newpath, delim); data/modules-4.6.1/compat/cmdPath.c:344: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(newpath, qualifiedpath); data/modules-4.6.1/compat/cmdPath.c:346: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(newpath, delim); data/modules-4.6.1/compat/cmdPath.c:348: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(newpath, startp); data/modules-4.6.1/compat/cmdPath.c:353: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(newpath, oldpath); data/modules-4.6.1/compat/cmdPath.c:355: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(newpath, delim); data/modules-4.6.1/compat/cmdPath.c:356: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(newpath, qualifiedpath); data/modules-4.6.1/compat/cmdPath.c:358: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(newpath, endp); data/modules-4.6.1/compat/cmdPath.c:367: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(newpath, oldpath); data/modules-4.6.1/compat/cmdPath.c:369: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(newpath, delim); data/modules-4.6.1/compat/cmdPath.c:370: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(newpath, qualifiedpath); data/modules-4.6.1/compat/cmdPath.c:372: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(newpath, qualifiedpath); data/modules-4.6.1/compat/cmdPath.c:373:27: [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). if (*oldpath != *delim) strcat(newpath, delim); data/modules-4.6.1/compat/cmdPath.c:374: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(newpath, oldpath); data/modules-4.6.1/compat/cmdTrace.c:521: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( pattern + 1, module_pat); data/modules-4.6.1/compat/cmdTrace.c:546:7: [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( tmp, pattern); data/modules-4.6.1/compat/cmdUname.c:181:26: [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 == (hname = popen( PHOSTNAME, "r"))) { data/modules-4.6.1/compat/cmdVersion.c:472:2: [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, ptr->name); data/modules-4.6.1/compat/cmdVersion.c:542:2: [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, g_current_module); data/modules-4.6.1/compat/cmdVersion.c:559:2: [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( t, s); data/modules-4.6.1/compat/cmdVersion.c:563:2: [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/modules-4.6.1/compat/cmdVersion.c:573: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, s); data/modules-4.6.1/compat/cmdVersion.c:575: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( buffer, t); data/modules-4.6.1/compat/cmdVersion.c:586: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( t, _default); data/modules-4.6.1/compat/cmdVersion.c:852:2: [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, g_current_module); data/modules-4.6.1/compat/cmdVersion.c:860:2: [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/modules-4.6.1/compat/cmdXResource.c:177:2: [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( defines, title); data/modules-4.6.1/compat/cmdXResource.c:186:6: [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( defines, (quote ? "=\"" : "=")); data/modules-4.6.1/compat/cmdXResource.c:187:6: [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( defines, value); data/modules-4.6.1/compat/cmdXResource.c:247: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( server, XDisplayName( NULL)); data/modules-4.6.1/compat/cmdXResource.c:252:2: [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( server, client); data/modules-4.6.1/compat/cmdXResource.c:765:2: [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( defines, CPPSTDIN); data/modules-4.6.1/compat/cmdXResource.c:767:2: [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( defines, CPPMINUS); data/modules-4.6.1/compat/cmdXResource.c:910:13: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. is_file = (access( argv[ opt_ind], R_OK & F_OK) == 0); data/modules-4.6.1/compat/cmdXResource.c:938:7: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. popen( strcat( defines, argv[ opt_ind]), "r") : data/modules-4.6.1/compat/cmdXResource.c:938: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). popen( strcat( defines, argv[ opt_ind]), "r") : data/modules-4.6.1/compat/error.c:457:2: [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++); data/modules-4.6.1/compat/error.c:467:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( s, " [%s(%d)", (pwent ? pwent->pw_name : _unknown), uid); data/modules-4.6.1/compat/error.c:470:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( s, ".%s(%d)]", (grpent ? grpent->gr_name : _unknown), gid); data/modules-4.6.1/compat/error.c:474:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( s, " [%s(%d)", (pwent ? pwent->pw_name : _unknown), uid); data/modules-4.6.1/compat/error.c:477:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( s, ".%s(%d)] = ", (grpent ? grpent->gr_name : _unknown), gid); data/modules-4.6.1/compat/error.c:1378:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( errbuffer, "%s(%s):%s:%d: %s\n", g_current_module, data/modules-4.6.1/compat/error.c:1383:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( errbuffer, "%s(%s):%s:%d: %s\n", (module ? module : "??"), data/modules-4.6.1/compat/error.c:1585: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( *Target, argv[ index]); data/modules-4.6.1/compat/getopt.c:940:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( buffer, "%c%s", argv[optind - 1][0], pfound->name); data/modules-4.6.1/compat/getopt.c:1030:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( buffer, "%c%s", argv[optind][0], nextchar); data/modules-4.6.1/compat/locate_module.c:796:17: [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( mpath, file->d_name); data/modules-4.6.1/compat/main.c:769:4: [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(output,format,b,x);} data/modules-4.6.1/compat/main.c:775:2: [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(output, format, "VERSION", version_string); data/modules-4.6.1/compat/main.c:776:2: [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(output, format, "DATE", date_string); data/modules-4.6.1/compat/utility.c:894: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. fprintf( stdout, sourceCommand, aliasfilename, shell_cmd_separator); data/modules-4.6.1/compat/utility.c:1969: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). strcpy( filename, modulefile_path); data/modules-4.6.1/compat/utility.c:2858:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename2,"%s/modulesource_%d",TMP_DIR,trial++); data/modules-4.6.1/compat/utility.c:2922:38: [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). char *(*strfn)(char*,const char*) = strcpy; data/modules-4.6.1/compat/utility.c:2956:11: [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). strfn = strcat; data/modules-4.6.1/lib/envmodules.c:120:15: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (!access(path, R_OK)) { data/modules-4.6.1/lib/envmodules.c:124:35: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (fetch_dotversion && !access(path, R_OK)) { data/modules-4.6.1/compat/ModuleCmd_Init.c:175:43: [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 ((char *) NULL == (home = (char *) getenv("HOME"))) data/modules-4.6.1/compat/ModuleCmd_List.c:113: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. loaded = getenv( "LOADEDMODULES"); data/modules-4.6.1/compat/ModuleCmd_Refresh.c:123: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. loaded = getenv( "LOADEDMODULES" ); data/modules-4.6.1/compat/ModuleCmd_Update.c:126:31: [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( !( tmpload = (char *) getenv("LOADEDMODULES"))) { data/modules-4.6.1/compat/ModuleCmd_Whatis.c:717: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. if( env = getenv( "MODULEWHATISCACHE")) { data/modules-4.6.1/compat/cmdIsLoaded.c:125:33: [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( !(modulepath = (char *) getenv( "MODULEPATH"))) { data/modules-4.6.1/compat/cmdXResource.c:884:10: [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("DISPLAY")) { data/modules-4.6.1/compat/getopt.c:171:7: [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(); data/modules-4.6.1/compat/getopt.c:558: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. posixly_correct = getenv( "POSIXLY_CORRECT"); data/modules-4.6.1/compat/getopt.c:1215:5: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt( int argc, char *const *argv, const char *optstring) data/modules-4.6.1/compat/getopt.c:1230:5: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt_long( int argc, char *const *argv, const char *optstring, data/modules-4.6.1/compat/getopt.c:1312:6: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long( argc, argv, "abc:d:0123456789", longopts, &longind); data/modules-4.6.1/compat/getopt.h:157:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt( int argc, char *const *argv, const char *shortopts); data/modules-4.6.1/compat/getopt.h:159:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long( int argc, char *const *argv, const char *shortopts, data/modules-4.6.1/compat/getopt.h:167:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt(); data/modules-4.6.1/compat/getopt.h:168:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long(); data/modules-4.6.1/compat/init.c:448:7: [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( "_MODULESBEGINENV_") ) { data/modules-4.6.1/compat/init.c:478:10: [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( "_MODULESBEGINENV_") ) { data/modules-4.6.1/compat/init.c:486: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. tmp = getenv("HOME"); data/modules-4.6.1/compat/init.c:487:29: [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((char *) NULL == (tmp = getenv("HOME"))) data/modules-4.6.1/compat/locate_module.c:244:32: [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( !( modulespath = (char *) getenv( "MODULEPATH"))) { data/modules-4.6.1/compat/main.c:292:33: [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. TCL_ERROR == SourceRC( interp, getenv( "HOME"), modulerc_file)) data/modules-4.6.1/compat/main.c:554:21: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while( EOF != (c = getopt_long( *argc-1, &argv[1], "hpftlvsciu:aHV", data/modules-4.6.1/compat/utility.c:2659: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. envvar = getenv(dollarptr + 1 + brace); data/modules-4.6.1/compat/utility.c:2715: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. return xdup(getenv(var)); data/modules-4.6.1/compat/ModuleCmd_Avail.c:96: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 buffer[MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Avail.c:97: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 buf[ LINELENGTH]; data/modules-4.6.1/compat/ModuleCmd_Avail.c:124: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 buffer1[ 80], buffer2[ 80]; data/modules-4.6.1/compat/ModuleCmd_Avail.c:139: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 _file_list_buffer[ 200]; data/modules-4.6.1/compat/ModuleCmd_Avail.c:497:24: [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( NULL == (fi = fopen( namebuf, "r"))) { data/modules-4.6.1/compat/ModuleCmd_Avail.c:644:25: [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( NULL != (cdir = fopen( namebuf, "r"))) { data/modules-4.6.1/compat/ModuleCmd_Avail.c:859:21: [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( NULL == (fi = fopen( buffer, "r"))) { data/modules-4.6.1/compat/ModuleCmd_Avail.c:1174:23: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( NULL == (fi = fopen( namebuf, "w+"))) data/modules-4.6.1/compat/ModuleCmd_Avail.c:1181:25: [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( NULL == (cdir = fopen( namebuf, "w+"))) { data/modules-4.6.1/compat/ModuleCmd_Avail.c:1543: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[ 20]; data/modules-4.6.1/compat/ModuleCmd_Avail.c:1544: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 modulefile[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Avail.c:1545: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 modulename[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Avail.c:1725: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( buffer, "%04d/%02d/%02d %2d:%02d:%02d", data/modules-4.6.1/compat/ModuleCmd_Avail.c:2043:12: [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 dirbuf[ MOD_BUFSIZE]; /** Buffer for path creation **/ data/modules-4.6.1/compat/ModuleCmd_Clear.c:100: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[10]; data/modules-4.6.1/compat/ModuleCmd_Display.c:111: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 modulefile[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Display.c:112: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 modulename[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Help.c:167: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 modulefile[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Help.c:168: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 modulename[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Init.c:217:25: [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 (NULL == (fileptr = fopen(home_pathname, "r"))) data/modules-4.6.1/compat/ModuleCmd_Init.c:231:38: [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 *) NULL == (newfileptr = fopen(home_pathname, "w")))) { data/modules-4.6.1/compat/ModuleCmd_List.c:103: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 *list[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_List.c:104: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 *files[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_List.c:105: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 *tmplist[ MOD_BUFSIZE], *s; data/modules-4.6.1/compat/ModuleCmd_Load.c:114: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 filename[ MOD_BUFSIZE], /** Module filename **/ data/modules-4.6.1/compat/ModuleCmd_Purge.c:100: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 *unload_argv_rev[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Refresh.c:110: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 *list[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Refresh.c:111: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 *files[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Update.c:142:22: [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( NULL != (file = fopen( filename, "r"))) { data/modules-4.6.1/compat/ModuleCmd_Use.c:132:33: [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( NULL != (file = fopen( filename, "a+"))) { data/modules-4.6.1/compat/ModuleCmd_Use.c:175: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 *pathargv[4]; /** Argument buffer for Tcl calls **/ data/modules-4.6.1/compat/ModuleCmd_Use.c:291: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 *pathargv[4]; data/modules-4.6.1/compat/ModuleCmd_Whatis.c:113: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 modulefile[ MOD_BUFSIZE], data/modules-4.6.1/compat/ModuleCmd_Whatis.c:211:37: [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 *) NULL == (cachefp = fopen( cache_file, "r"))) { data/modules-4.6.1/compat/ModuleCmd_Whatis.c:239:35: [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 *) NULL == (cachefp = fopen( cache_file, "w"))) data/modules-4.6.1/compat/ModuleCmd_Whatis.c:363:33: [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 *) NULL == (cachefp = fopen( cache_file, "r"))) { data/modules-4.6.1/compat/ModuleCmd_Whatis.c:391:37: [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 *) NULL == (cachefp = fopen( cache_file, "w"))) data/modules-4.6.1/compat/ModuleCmd_Whatis.c:473: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 modulefile[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Whatis.c:631: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 modulefile[ MOD_BUFSIZE]; data/modules-4.6.1/compat/ModuleCmd_Whatis.c:632: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[ MOD_BUFSIZE]; data/modules-4.6.1/compat/cmdAlias.c:143:47: [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. set_marked_entry(markAliasHashTable, (char *) argv[1], M_SWSTATE1); data/modules-4.6.1/compat/cmdAlias.c:146:47: [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. set_marked_entry(markAliasHashTable, (char *) argv[1], M_SWSTATE2); data/modules-4.6.1/compat/cmdAlias.c:149:62: [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. if(marked_val = chk_marked_entry(markAliasHashTable,(char *) argv[1])) { data/modules-4.6.1/compat/cmdConflict.c:61: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 error_module[ MOD_BUFSIZE]; data/modules-4.6.1/compat/cmdConflict.c:305:18: [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. pathlist[j], (char *) argv[i], &nummodules))) data/modules-4.6.1/compat/cmdConflict.c:384:24: [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. *notloaded_flag = (char *) argv[1]; data/modules-4.6.1/compat/cmdConflict.c:387: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[ MOD_BUFSIZE]; data/modules-4.6.1/compat/cmdConflict.c:464:55: [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. ErrorLogger( NO_ERR_DEBUG, LOC, "Scanning all ", (sprintf( buffer, "%d", data/modules-4.6.1/compat/cmdConflict.c:472:11: [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 *) argv[i], &nummodules))) data/modules-4.6.1/compat/cmdConflict.c:482: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( buffer, "%d", listcnt), buffer), NULL); data/modules-4.6.1/compat/cmdConflict.c:496:39: [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. notloaded_flag = (char *) argv[i]; data/modules-4.6.1/compat/cmdInfo.c:108: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 *s, *t, buf[ BUFSIZ]; data/modules-4.6.1/compat/cmdInfo.c:136: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. char tmpbuf[6]; data/modules-4.6.1/compat/cmdInfo.c:137:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( tmpbuf, "%d", g_flags); data/modules-4.6.1/compat/cmdInfo.c:299: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. cmd = (char *) argv[ 2]; data/modules-4.6.1/compat/cmdInfo.c:304:16: [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. module = (char *) argv[ 3]; data/modules-4.6.1/compat/cmdInfo.c:317: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. cmd = (char *) argv[ 2]; data/modules-4.6.1/compat/cmdInfo.c:337:20: [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. if( AliasLookup( (char *) argv[2], &s, &t)) { data/modules-4.6.1/compat/cmdInfo.c:354:42: [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. name = (argc < 3) ? g_current_module : (char *) argv[2]; data/modules-4.6.1/compat/cmdInfo.c:367: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. if( VersionLookup( (char *) argv[2], &s, &t)) { data/modules-4.6.1/compat/cmdIsLoaded.c:98:31: [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 *notloaded_flag = (char *) argv[1]; data/modules-4.6.1/compat/cmdIsLoaded.c:145:11: [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 *) argv[i], &nummodules))) data/modules-4.6.1/compat/cmdIsLoaded.c:156:39: [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. notloaded_flag = (char *) argv[i]; data/modules-4.6.1/compat/cmdLog.c:145: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. if((char **) NULL == (facptr = GetFacilityPtr( (char *) argv[1]))) data/modules-4.6.1/compat/cmdMisc.c:105: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[ MAX_ARGLIST]; data/modules-4.6.1/compat/cmdMisc.c:142:60: [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. if( OK != ErrorLogger( ERR_ARGSTOLONG, LOC, argv[0], (sprintf( buf, data/modules-4.6.1/compat/cmdMisc.c:151: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. memcpy( bufp, argv[i], arg_len); data/modules-4.6.1/compat/cmdMisc.c:153: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. memcpy( bufp, " ", 1); data/modules-4.6.1/compat/cmdMisc.c:173: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( buf, "%d", (0xff & (i >> 8))); data/modules-4.6.1/compat/cmdModule.c:570:24: [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( NULL == (infile = fopen( filename, "r"))) { data/modules-4.6.1/compat/cmdModule.c:624:6: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[ 80]; data/modules-4.6.1/compat/cmdModule.c:627:20: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. case TCL_OK: strcpy( buffer, "TCL_OK"); data/modules-4.6.1/compat/cmdModule.c:630:23: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. case TCL_ERROR: strcpy( buffer, "TCL_ERROR"); data/modules-4.6.1/compat/cmdModule.c:634:9: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy( buffer, "TCL_LEVEL0_RETURN"); data/modules-4.6.1/compat/cmdModule.c:715: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 cmdline[ LINELENGTH]; data/modules-4.6.1/compat/cmdModule.c:730:21: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( 0 > (devnull = open( _fil_devnull, O_RDWR))) { data/modules-4.6.1/compat/cmdPath.c:80: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 buffer[ PATH_BUFLEN]; data/modules-4.6.1/compat/cmdPath.c:231:47: [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. if( !( pathlist = SplitIntoList( interp, (char *) argv[arg1+1], &numpaths, data/modules-4.6.1/compat/cmdPath.c:384:28: [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. moduleSetenv( interp, (char *) argv[arg1], newpath, 1); data/modules-4.6.1/compat/cmdPath.c:521:47: [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. if( !( pathlist = SplitIntoList( interp, (char *) argv[arg1+1], &numpaths, data/modules-4.6.1/compat/cmdPath.c:529:35: [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. if(TCL_OK != Remove_Path(interp,(char *) argv[arg1],pathlist[x], data/modules-4.6.1/compat/cmdSetenv.c:136:20: [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. var = (char *) argv[2]; data/modules-4.6.1/compat/cmdSetenv.c:137:20: [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. val = (char *) argv[3]; data/modules-4.6.1/compat/cmdSetenv.c:145:16: [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. var = (char *) argv[1]; data/modules-4.6.1/compat/cmdSetenv.c:146:16: [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. val = (char *) argv[2]; data/modules-4.6.1/compat/cmdSetenv.c:345:25: [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. moduleSetenv( interp, (char *) argv[1], (char *) argv[2], 0); data/modules-4.6.1/compat/cmdSetenv.c:345:43: [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. moduleSetenv( interp, (char *) argv[1], (char *) argv[2], 0); data/modules-4.6.1/compat/cmdSetenv.c:348:27: [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. moduleUnsetenv( interp, (char *) argv[1]); data/modules-4.6.1/compat/cmdUlvl.c:158:33: [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. return( cmdModuleUser_sub( (char *) argv[ 1])); data/modules-4.6.1/compat/cmdUname.c:52: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 sysname[ NAMELEN]; /** System name **/ data/modules-4.6.1/compat/cmdUname.c:53: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 nodename[ NAMELEN]; /** Node name **/ data/modules-4.6.1/compat/cmdUname.c:54: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 release[ NAMELEN]; /** OS Release **/ data/modules-4.6.1/compat/cmdUname.c:55: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 version[ NAMELEN]; /** OS Version **/ data/modules-4.6.1/compat/cmdUname.c:56: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 machine[ NAMELEN]; /** Machine type **/ data/modules-4.6.1/compat/cmdUname.c:89: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 domain[ DOMAINLEN] = UNAME_DOMAIN; data/modules-4.6.1/compat/cmdVersion.c:247:56: [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. if((char *) NULL == (module = CheckModuleVersion( (char *) argv[1]))) { data/modules-4.6.1/compat/cmdVersion.c:299: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. && FindName( (char *) argv[i], modptr->name, &tmp)) { data/modules-4.6.1/compat/cmdVersion.c:306:44: [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. if((ModName *)NULL == (nameptr = AddName((char *)argv[ i],&modptr->name, data/modules-4.6.1/compat/cmdVersion.c:351:12: [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[ BUFSIZ]; data/modules-4.6.1/compat/cmdVersion.c:526:12: [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[ BUFSIZ]; data/modules-4.6.1/compat/cmdVersion.c:664:28: [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. trg_alias = FindName( (char *) argv[ 2], aliaslist, &tmp); data/modules-4.6.1/compat/cmdVersion.c:667:57: [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. if((char *) NULL == (module = CheckModuleVersion( (char *) argv[2]))) data/modules-4.6.1/compat/cmdVersion.c:668:16: [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. module = (char *) argv[ 2]; data/modules-4.6.1/compat/cmdVersion.c:679:26: [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. if( ptr = FindName( (char *) argv[ 1], aliaslist, &tmp)) { data/modules-4.6.1/compat/cmdVersion.c:701:41: [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. if((ModName *) NULL == (ptr = AddName((char *) argv[ 1], data/modules-4.6.1/compat/cmdVersion.c:839:12: [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[ BUFSIZ]; data/modules-4.6.1/compat/cmdXResource.c:176:2: [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( defines, " -D"); data/modules-4.6.1/compat/cmdXResource.c:199: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 num[ 20]; data/modules-4.6.1/compat/cmdXResource.c:205: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( num, "%d", value); data/modules-4.6.1/compat/cmdXResource.c:232: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 client[ MAXHOSTNAME], /** X client name buffer **/ data/modules-4.6.1/compat/cmdXResource.c:939:7: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fopen( argv[ opt_ind], "r")) ) ) data/modules-4.6.1/compat/error.c:144: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 buffer[ ERR_LINELEN]; /** Internal string buffer **/ data/modules-4.6.1/compat/error.c:486:6: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy( s, "TCL_OK"); data/modules-4.6.1/compat/error.c:489:6: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy( s, "TCL_ERROR"); data/modules-4.6.1/compat/error.c:492:6: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy( s, "TCL_RETURN"); data/modules-4.6.1/compat/error.c:495:6: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy( s, "TCL_BREAK"); data/modules-4.6.1/compat/error.c:498:6: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy( s, "TCL_CONTINUE"); data/modules-4.6.1/compat/error.c:501:6: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy( s, "UNKNOWN"); data/modules-4.6.1/compat/error.c:506: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( s, "(%d)", result); data/modules-4.6.1/compat/error.c:649:40: [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. return( ErrorLogger( ERR_INVAL, LOC, (sprintf( buffer, "%d", data/modules-4.6.1/compat/error.c:661:42: [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. return( ErrorLogger( ERR_INVWGHT, LOC, (sprintf( buffer, "%d", data/modules-4.6.1/compat/error.c:993:35: [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 *) NULL == (facfp = fopen( fac, "a"))) { data/modules-4.6.1/compat/error.c:1078: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[ 20]; data/modules-4.6.1/compat/error.c:1108:44: [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. if( OK == ErrorLogger( ERR_INVWGHT, LOC, (sprintf( buffer, "%d", data/modules-4.6.1/compat/error.c:1379: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( buffer, "%d", linenum), buffer), data/modules-4.6.1/compat/error.c:1384:18: [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. ( lineno ? (sprintf( buffer, "%d", lineno), buffer) : "??" ), data/modules-4.6.1/compat/error.c:1562: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). index = atoi( buffer) - 1; data/modules-4.6.1/compat/getopt.c:939: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. char buffer[ BUFSIZ]; data/modules-4.6.1/compat/getopt.c:1029: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 buffer[ BUFSIZ]; data/modules-4.6.1/compat/getopt.c:1068: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 buffer[ 2]; data/modules-4.6.1/compat/getopt.c:1142: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 buffer[ 2]; data/modules-4.6.1/compat/init.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( buffer, "EXIT %d", value); data/modules-4.6.1/compat/init.c:450: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( (file = fopen(tmp, "w+")) ) { data/modules-4.6.1/compat/init.c:495:24: [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(buffer, "w+")) { data/modules-4.6.1/compat/locate_module.c:83: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 buf[ MOD_BUFSIZE]; data/modules-4.6.1/compat/locate_module.c:84: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 modfil_buf[ MOD_BUFSIZE]; data/modules-4.6.1/compat/locate_module.c:1159: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 *new_argv[3]; data/modules-4.6.1/compat/main.c:679:20: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int temp_fd = open("/dev/null", O_RDWR); data/modules-4.6.1/compat/utility.c:1041:6: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char formatted[ MOD_BUFSIZE]; data/modules-4.6.1/compat/utility.c:1050:6: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[ LMSPLIT_SIZE + 1]; data/modules-4.6.1/compat/utility.c:1090: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( formatted, "_LMFILES_%03d", count++); data/modules-4.6.1/compat/utility.c:1664: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. char buffer[ MOD_BUFSIZE]; /** Used to set up the split variab- **/ data/modules-4.6.1/compat/utility.c:1676:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( buffer, "_LMFILES_%03d", count++); data/modules-4.6.1/compat/utility.c:1704:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( buffer, "_LMFILES_%03d", count++); data/modules-4.6.1/compat/utility.c:2134: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 *argv[4]; data/modules-4.6.1/compat/utility.c:2226: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[BUFSIZ]; /** Read buffer **/ data/modules-4.6.1/compat/utility.c:2244:19: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if( 0 > (fd = open( filename, O_RDONLY))) data/modules-4.6.1/compat/utility.c:2606: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[MOD_BUFSIZE]; data/modules-4.6.1/compat/utility.c:2607: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 oldbuffer[MOD_BUFSIZE]; data/modules-4.6.1/compat/utility.c:2859:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fildes = open(filename2,O_WRONLY | O_CREAT | O_EXCL | O_TRUNC,0755); data/modules-4.6.1/compat/utility.c:3098:13: [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). result = atoi((const char *) startp); data/modules-4.6.1/compat/utility.c:3260: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 (!(tty = fopen("/dev/tty","w"))) { data/modules-4.6.1/lib/envmodules.c:81: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[PATH_MAX]; data/modules-4.6.1/lib/envmodules.c:201: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 buf[READ_BUFFER_SIZE]; data/modules-4.6.1/lib/envmodules.c:220:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fid = open(filename, O_RDONLY)) == -1) { data/modules-4.6.1/lib/envmodules.c:292: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 uidstr[16]; data/modules-4.6.1/lib/envmodules.c:301: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 (uidstr, "%d", uid); data/modules-4.6.1/lib/envmodules.c:352: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 gidstr[16]; data/modules-4.6.1/lib/envmodules.c:419:10: [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(gidstr, "%d", groups[i]); data/modules-4.6.1/lib/envmodules.c:508: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 dt[17]; data/modules-4.6.1/lib/envmodules.c:531:10: [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(dt, "T00:00"); data/modules-4.6.1/compat/ModuleCmd_Avail.c:451: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). dirlen = strlen( dir) + 1; data/modules-4.6.1/compat/ModuleCmd_Avail.c:480:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask( CACHE_UMASK); data/modules-4.6.1/compat/ModuleCmd_Avail.c:997: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). mlen = strlen( module); data/modules-4.6.1/compat/ModuleCmd_Avail.c:1324: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). filelen = strlen( file->fi_name); data/modules-4.6.1/compat/ModuleCmd_Avail.c:1419: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). mlen = strlen( module); data/modules-4.6.1/compat/ModuleCmd_Avail.c:1635: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). prefixLength = colon == NULL ? strlen(prefix) : data/modules-4.6.1/compat/ModuleCmd_Avail.c:1663:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). t = strlen(path); data/modules-4.6.1/compat/ModuleCmd_Avail.c:1714: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). tmp_len = strlen( _file_list_buffer); data/modules-4.6.1/compat/ModuleCmd_Avail.c:1816: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). int lin_len = terminal_width - strlen( header) - 2; data/modules-4.6.1/compat/ModuleCmd_Avail.c:1999: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). filelen = strlen( name); data/modules-4.6.1/compat/ModuleCmd_Avail.c:2062:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( (int) ( strlen( dir) + 1 + strlen( file) + 1 ) > MOD_BUFSIZE) { data/modules-4.6.1/compat/ModuleCmd_Avail.c:2062:36: [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( (int) ( strlen( dir) + 1 + strlen( file) + 1 ) > MOD_BUFSIZE) { data/modules-4.6.1/compat/ModuleCmd_Avail.c:2073: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( dir[ strlen( dir) - 1] != '/' && file[0] != '/') data/modules-4.6.1/compat/ModuleCmd_Avail.c:2074:2: [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( dirbuf, "/"); data/modules-4.6.1/compat/ModuleCmd_Help.c:211:31: [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). g_current_module, (int)(20-strlen( g_current_module)), data/modules-4.6.1/compat/ModuleCmd_Init.c:158:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). modcmdObj = Tcl_NewStringObj(Modcmd,strlen(Modcmd)); data/modules-4.6.1/compat/ModuleCmd_Init.c:183: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). homelen = strlen(home) + 40; data/modules-4.6.1/compat/ModuleCmd_Init.c:193: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). home_end = strlen(home_pathname); data/modules-4.6.1/compat/ModuleCmd_Init.c:224: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). path_end = strlen(home_pathname); data/modules-4.6.1/compat/ModuleCmd_List.c:158: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). len = strlen( files[i]) - strlen( list[i]); data/modules-4.6.1/compat/ModuleCmd_List.c:158: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). len = strlen( files[i]) - strlen( list[i]); data/modules-4.6.1/compat/ModuleCmd_Update.c:170:33: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if( '\n' == (*ptr++ = c = fgetc( file))) { data/modules-4.6.1/compat/ModuleCmd_Whatis.c:555:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( modulefile, *wptr, MOD_BUFSIZE); data/modules-4.6.1/compat/ModuleCmd_Whatis.c:648:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( modulefile, wptr, MOD_BUFSIZE); data/modules-4.6.1/compat/cmdConflict.c:525: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). buffer + strlen(buffer), MOD_BUFSIZE-strlen(buffer), data/modules-4.6.1/compat/cmdConflict.c:525:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). buffer + strlen(buffer), MOD_BUFSIZE-strlen(buffer), data/modules-4.6.1/compat/cmdConflict.c:536: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). buffer[strlen(buffer)-1] = '\0'; /* remove last blank */ data/modules-4.6.1/compat/cmdInfo.c:340:6: [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( buf, "/"); data/modules-4.6.1/compat/cmdInfo.c:371: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( buf, "/"); data/modules-4.6.1/compat/cmdLog.c:161: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). len += strlen( argv[ i]) + 1; data/modules-4.6.1/compat/cmdLog.c:177:47: [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((char *) NULL == (tmp = stringer(NULL, strlen( faclist), NULL))) { data/modules-4.6.1/compat/cmdLog.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). t += strlen( s); data/modules-4.6.1/compat/cmdMisc.c:140:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). total_len += (1 + (arg_len = strlen(argv[i]))); data/modules-4.6.1/compat/cmdModule.c:819:5: [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( cmdline, "\n"); data/modules-4.6.1/compat/cmdPath.c:244: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). qpathlen = strlen(qualifiedpath)+1; data/modules-4.6.1/compat/cmdPath.c:265:36: [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). np_obj = Tcl_NewStringObj(newpath,strlen(newpath)); data/modules-4.6.1/compat/cmdPath.c:275:36: [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 (!stringer(qualifiedpath + strlen(qualifiedpath), data/modules-4.6.1/compat/cmdPath.c:276: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). qpathlen - strlen(qualifiedpath), data/modules-4.6.1/compat/cmdPath.c:292:19: [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). qualifiedpath[strlen(qualifiedpath) - 1] = '\0'; data/modules-4.6.1/compat/cmdPath.c:298: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). if(!(newpath = stringer(NULL, strlen( oldpath) + data/modules-4.6.1/compat/cmdPath.c:299:2: [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(qualifiedpath) + 2,NULL))) data/modules-4.6.1/compat/cmdPath.c:320: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). Tcl_NewStringObj(sw_marker,strlen(sw_marker)); data/modules-4.6.1/compat/cmdPath.c:342:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(newpath) > 0 && newpath[strlen(newpath)-1] != *delim) data/modules-4.6.1/compat/cmdPath.c:342:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(newpath) > 0 && newpath[strlen(newpath)-1] != *delim) data/modules-4.6.1/compat/cmdPath.c:345: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). if (newpath[strlen(newpath)-1] != *delim) data/modules-4.6.1/compat/cmdPath.c:354: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). if (newpath[strlen(newpath)-1] != *delim) data/modules-4.6.1/compat/cmdPath.c:368: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). if (newpath[strlen(newpath)-1] != *delim) data/modules-4.6.1/compat/cmdPath.c:614: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). oldpathlen = strlen(oldpath); data/modules-4.6.1/compat/cmdPath.c:633: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). olditem += strlen(olditem) + 1) { data/modules-4.6.1/compat/cmdTrace.c:333:32: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( !strncmp( tmp, "-module", strlen( tmp))) data/modules-4.6.1/compat/cmdTrace.c:476:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen( module_pat); data/modules-4.6.1/compat/cmdTrace.c:534: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( TraceSelect[ i].tracing)))) { data/modules-4.6.1/compat/cmdUlvl.c:192: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). len_arg = strlen( user_level); data/modules-4.6.1/compat/cmdUname.c:187: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). namestruct.nodename[ strlen( namestruct.nodename)-1] = '\0'; data/modules-4.6.1/compat/cmdUname.c:219: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). length = strlen( argv[1]); data/modules-4.6.1/compat/cmdVersion.c:459:19: [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( *(mayloop + strlen(ptr->name)) == ':' ) { data/modules-4.6.1/compat/cmdVersion.c:474:2: [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( buffer, ":"); data/modules-4.6.1/compat/cmdVersion.c:475: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). buffer += strlen( buffer); data/modules-4.6.1/compat/cmdVersion.c:544:19: [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). t = buffer + strlen( buffer); data/modules-4.6.1/compat/cmdVersion.c:574: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( buffer, "/"); data/modules-4.6.1/compat/cmdVersion.c:583: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). t = buffer + strlen( buffer); data/modules-4.6.1/compat/cmdXResource.c:189: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( defines,"\""); data/modules-4.6.1/compat/cmdXResource.c:452:33: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). res_obj = Tcl_NewStringObj(Res,strlen(Res)); data/modules-4.6.1/compat/cmdXResource.c:766:2: [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( defines, " "); data/modules-4.6.1/compat/cmdXResource.c:768:2: [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( defines, " "); data/modules-4.6.1/compat/cmdXResource.c:771: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). def_base = strlen( strcat( defines, " ")); data/modules-4.6.1/compat/cmdXResource.c:771:21: [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. def_base = strlen( strcat( defines, " ")); data/modules-4.6.1/compat/error.c:458:2: [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/modules-4.6.1/compat/error.c:459:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen( s); data/modules-4.6.1/compat/error.c:468:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen( s); data/modules-4.6.1/compat/error.c:471:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen( s); data/modules-4.6.1/compat/error.c:475:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen( s); data/modules-4.6.1/compat/error.c:478:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen( s); data/modules-4.6.1/compat/error.c:505:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). s += strlen( s); data/modules-4.6.1/compat/error.c:1272: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( facility); data/modules-4.6.1/compat/error.c:1574: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). len = strlen( argv[ index]); data/modules-4.6.1/compat/getopt.c:199: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). extern int strlen( const char *); data/modules-4.6.1/compat/getopt.c:841:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( nameend - nextchar == strlen( p->name)) { data/modules-4.6.1/compat/getopt.c:887: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). nextchar += strlen( nextchar); data/modules-4.6.1/compat/getopt.c:949:19: [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). nextchar += strlen( nextchar); data/modules-4.6.1/compat/getopt.c:977:19: [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). nextchar += strlen( nextchar); data/modules-4.6.1/compat/getopt.c:987: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). nextchar += strlen( nextchar); data/modules-4.6.1/compat/init.c:704: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). envsize += strlen( environ[i]) + 1; data/modules-4.6.1/compat/locate_module.c:226: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( modulename) + 1 + strlen( result) + 1 > MOD_BUFSIZE)) { data/modules-4.6.1/compat/locate_module.c:226: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). (strlen( modulename) + 1 + strlen( result) + 1 > MOD_BUFSIZE)) { data/modules-4.6.1/compat/locate_module.c:280:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( strlen( pathlist[i]) + 2 + strlen( result) > MOD_BUFSIZE) { data/modules-4.6.1/compat/locate_module.c:280:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if( strlen( pathlist[i]) + 2 + strlen( result) > MOD_BUFSIZE) { data/modules-4.6.1/compat/locate_module.c:320:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( realname, result, MOD_BUFSIZE); data/modules-4.6.1/compat/locate_module.c:390: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). slen = strlen( s) + 1; data/modules-4.6.1/compat/locate_module.c:474: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). int len = strlen( mod1) + strlen( ver1) + 2; data/modules-4.6.1/compat/locate_module.c:474:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen( mod1) + strlen( ver1) + 2; data/modules-4.6.1/compat/locate_module.c:501: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). int len = strlen( mod) + 1; data/modules-4.6.1/compat/locate_module.c:504: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). len += strlen( prefix) +1; data/modules-4.6.1/compat/locate_module.c:600: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). int len = strlen( Result) + 1; data/modules-4.6.1/compat/locate_module.c:603: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). len += strlen( prefix) + 1; data/modules-4.6.1/compat/locate_module.c:711: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). pathlen = strlen(full_path); data/modules-4.6.1/compat/modules_def.h:111:28: [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 NLENGTH(dirent) (strlen((dirent)->d_name)) data/modules-4.6.1/compat/utility.c:1045:36: [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* escaped = stringer(NULL,strlen(val)*2+1,NULL); data/modules-4.6.1/compat/utility.c:1048:25: [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(( lmfiles_len = strlen(escaped)) > LMSPLIT_SIZE) { data/modules-4.6.1/compat/utility.c:1057:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( buffer, ( escaped + count*LMSPLIT_SIZE ), data/modules-4.6.1/compat/utility.c:1105:33: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char* escaped = stringer(NULL,strlen(val)*2+1,NULL); data/modules-4.6.1/compat/utility.c:1119: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). char* escaped = (char*)module_malloc(strlen(val)*2+1); data/modules-4.6.1/compat/utility.c:1136:33: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char* escaped = stringer(NULL,strlen(val)*2+1,NULL); data/modules-4.6.1/compat/utility.c:1158:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char* escaped = stringer(NULL, strlen(val)*2+1,NULL); data/modules-4.6.1/compat/utility.c:1684: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). cptr_len = strlen( cptr); data/modules-4.6.1/compat/utility.c:1698:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( lmfiles + old_lmsize, cptr, cptr_len); data/modules-4.6.1/compat/utility.c:2248:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_len = read( fd, buf, magic_len); data/modules-4.6.1/compat/utility.c:2291:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). unsigned int path_len = strlen( path); /** Length of the orig. path **/ data/modules-4.6.1/compat/utility.c:2620:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(oldbuffer, slashptr, MOD_BUFSIZE-1); data/modules-4.6.1/compat/utility.c:2624:20: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). if (*oldbuffer) strncpy(buffer, oldbuffer, MOD_BUFSIZE); data/modules-4.6.1/compat/utility.c:2625: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). blen = strlen(buffer); data/modules-4.6.1/compat/utility.c:2648:5: [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. strncat(buffer, dollarptr, MOD_BUFSIZE-blen); data/modules-4.6.1/compat/utility.c:2649: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). blen = strlen(buffer); data/modules-4.6.1/compat/utility.c:2651:6: [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. Risk is low because the source is a constant character. strncat(buffer,"}",MOD_BUFSIZE-blen-1); data/modules-4.6.1/compat/utility.c:2662:18: [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. if (envvar) strncat(buffer,envvar, data/modules-4.6.1/compat/utility.c:2666: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). blen = strlen(buffer); data/modules-4.6.1/compat/utility.c:2674:5: [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. strncat(buffer, slashptr + brace, data/modules-4.6.1/compat/utility.c:2678:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(oldbuffer, buffer, MOD_BUFSIZE); data/modules-4.6.1/compat/utility.c:2851: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). stringer(NULL, strlen(TMP_DIR)+strlen("modulesource")+20, NULL))) data/modules-4.6.1/compat/utility.c:2851:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). stringer(NULL, strlen(TMP_DIR)+strlen("modulesource")+20, NULL))) data/modules-4.6.1/compat/utility.c:2932: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). sumlen += strlen(ptr); data/modules-4.6.1/compat/utility.c:3072: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). exit_Ptr = Tcl_NewStringObj(Exit_,strlen(Exit_)); data/modules-4.6.1/compat/utility.c:3079:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). break_Ptr = Tcl_NewStringObj(Break,strlen(Break)); data/modules-4.6.1/compat/utility.c:3086:36: [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). cont_Ptr = Tcl_NewStringObj(Cont,strlen(Cont)); data/modules-4.6.1/lib/envmodules.c:237:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(fid, buf, FIRSTLINE_LENGTH)) > 0) { data/modules-4.6.1/lib/envmodules.c:241:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(fid, buf, READ_BUFFER_SIZE)) > 0) { data/modules-4.6.1/lib/envmodules.c:316:39: [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). Tcl_AppendToObj(res, pwd->pw_name, strlen(pwd->pw_name)); data/modules-4.6.1/lib/envmodules.c:524:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dt, datetime, 16); data/modules-4.6.1/lib/envmodules.c:529:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dt, datetime, 10); ANALYSIS SUMMARY: Hits = 395 Lines analyzed = 24600 in approximately 1.03 seconds (23771 lines/second) Physical Source Lines of Code (SLOC) = 10653 Hits@level = [0] 200 [1] 129 [2] 161 [3] 25 [4] 80 [5] 0 Hits@level+ = [0+] 595 [1+] 395 [2+] 266 [3+] 105 [4+] 80 [5+] 0 Hits/KSLOC@level+ = [0+] 55.8528 [1+] 37.0788 [2+] 24.9695 [3+] 9.85638 [4+] 7.50962 [5+] 0 Symlinks skipped = 44 (--allowlink overrides but see doc for security issue) Dot directories skipped = 6 (--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.