diff -Naur quake3-1.32b.orig/code/cgame/cg_weapons.c quake3-1.32b/code/cgame/cg_weapons.c
--- quake3-1.32b.orig/code/cgame/cg_weapons.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/cgame/cg_weapons.c	2006-05-06 13:20:41.000000000 +0200
@@ -656,17 +656,17 @@
 	}
 
 	strcpy( path, item->world_model[0] );
-	COM_StripExtension( path, path );
+	COM_StripExtension(path, path, sizeof(path));
 	strcat( path, "_flash.md3" );
 	weaponInfo->flashModel = trap_R_RegisterModel( path );
 
 	strcpy( path, item->world_model[0] );
-	COM_StripExtension( path, path );
+	COM_StripExtension(path, path, sizeof(path));
 	strcat( path, "_barrel.md3" );
 	weaponInfo->barrelModel = trap_R_RegisterModel( path );
 
 	strcpy( path, item->world_model[0] );
-	COM_StripExtension( path, path );
+	COM_StripExtension(path, path, sizeof(path));
 	strcat( path, "_hand.md3" );
 	weaponInfo->handsModel = trap_R_RegisterModel( path );
 
diff -Naur quake3-1.32b.orig/code/game/q_shared.c quake3-1.32b/code/game/q_shared.c
--- quake3-1.32b.orig/code/game/q_shared.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/game/q_shared.c	2006-05-06 13:30:23.000000000 +0200
@@ -58,11 +58,20 @@
 COM_StripExtension
 ============
 */
-void COM_StripExtension( const char *in, char *out ) {
-	while ( *in && *in != '.' ) {
-		*out++ = *in++;
+void COM_StripExtension( const char *in, char *out, int destsize ) {
+	int             length;
+
+	Q_strncpyz(out, in, destsize);
+
+	length = strlen(out)-1;
+	while (length > 0 && out[length] != '.')
+	{
+		length--;
+		if (out[length] == '/')
+			return;         // no extension
 	}
-	*out = 0;
+	if (length)
+		out[length] = 0;
 }
 
 
diff -Naur quake3-1.32b.orig/code/game/q_shared.h quake3-1.32b/code/game/q_shared.h
--- quake3-1.32b.orig/code/game/q_shared.h	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/game/q_shared.h	2006-05-06 13:20:41.000000000 +0200
@@ -787,7 +787,7 @@
 float Com_Clamp( float min, float max, float value );
 
 char	*COM_SkipPath( char *pathname );
-void	COM_StripExtension( const char *in, char *out );
+void	COM_StripExtension(const char *in, char *out, int destsize);
 void	COM_DefaultExtension( char *path, int maxSize, const char *extension );
 
 void	COM_BeginParseSession( const char *name );
diff -Naur quake3-1.32b.orig/code/q3_ui/ui_playermodel.c quake3-1.32b/code/q3_ui/ui_playermodel.c
--- quake3-1.32b.orig/code/q3_ui/ui_playermodel.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/q3_ui/ui_playermodel.c	2006-05-06 13:20:41.000000000 +0200
@@ -391,7 +391,7 @@
 	int		numfiles;
 	char	dirlist[2048];
 	char	filelist[2048];
-	char	skinname[64];
+	char	skinname[MAX_QPATH];
 	char*	dirptr;
 	char*	fileptr;
 	int		i;
@@ -424,7 +424,7 @@
 		{
 			filelen = strlen(fileptr);
 
-			COM_StripExtension(fileptr,skinname);
+			COM_StripExtension(fileptr,skinname, sizeof(skinname));
 
 			// look for icon_????
 			if (!Q_stricmpn(skinname,"icon_",5))
diff -Naur quake3-1.32b.orig/code/q3_ui/ui_players.c quake3-1.32b/code/q3_ui/ui_players.c
--- quake3-1.32b.orig/code/q3_ui/ui_players.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/q3_ui/ui_players.c	2006-05-06 13:20:41.000000000 +0200
@@ -89,13 +89,13 @@
 
 	if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
 		strcpy( path, item->world_model[0] );
-		COM_StripExtension( path, path );
+		COM_StripExtension( path, path, sizeof(path) );
 		strcat( path, "_barrel.md3" );
 		pi->barrelModel = trap_R_RegisterModel( path );
 	}
 
 	strcpy( path, item->world_model[0] );
-	COM_StripExtension( path, path );
+	COM_StripExtension( path, path, sizeof(path) );
 	strcat( path, "_flash.md3" );
 	pi->flashModel = trap_R_RegisterModel( path );
 
diff -Naur quake3-1.32b.orig/code/q3_ui/ui_saveconfig.c quake3-1.32b/code/q3_ui/ui_saveconfig.c
--- quake3-1.32b.orig/code/q3_ui/ui_saveconfig.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/q3_ui/ui_saveconfig.c	2006-05-06 13:20:41.000000000 +0200
@@ -85,7 +85,7 @@
 		return;
 	}
 
-	COM_StripExtension(saveConfig.savename.field.buffer, configname );
+	COM_StripExtension(saveConfig.savename.field.buffer, configname, sizeof(configname));
 	trap_Cmd_ExecuteText( EXEC_APPEND, va( "writeconfig %s.cfg\n", configname ) );
 	UI_PopMenu();
 }
diff -Naur quake3-1.32b.orig/code/qcommon/vm.c quake3-1.32b/code/qcommon/vm.c
--- quake3-1.32b.orig/code/qcommon/vm.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/qcommon/vm.c	2006-05-06 13:20:41.000000000 +0200
@@ -225,7 +225,7 @@
 		return;
 	}
 
-	COM_StripExtension( vm->name, name );
+	COM_StripExtension(vm->name, name, sizeof(name));
 	Com_sprintf( symbols, sizeof( symbols ), "vm/%s.map", name );
 	len = FS_ReadFile( symbols, (void **)&mapfile );
 	if ( !mapfile ) {
diff -Naur quake3-1.32b.orig/code/renderer/tr_bsp.c quake3-1.32b/code/renderer/tr_bsp.c
--- quake3-1.32b.orig/code/renderer/tr_bsp.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/renderer/tr_bsp.c	2006-05-06 13:20:41.000000000 +0200
@@ -1820,7 +1820,7 @@
 	Q_strncpyz( s_worldData.name, name, sizeof( s_worldData.name ) );
 
 	Q_strncpyz( s_worldData.baseName, COM_SkipPath( s_worldData.name ), sizeof( s_worldData.name ) );
-	COM_StripExtension( s_worldData.baseName, s_worldData.baseName );
+	COM_StripExtension(s_worldData.baseName, s_worldData.baseName, sizeof(s_worldData.baseName));
 
 	startMarker = ri.Hunk_Alloc(0, h_low);
 	c_gridVerts = 0;
diff -Naur quake3-1.32b.orig/code/renderer/tr_shader.c quake3-1.32b/code/renderer/tr_shader.c
--- quake3-1.32b.orig/code/renderer/tr_shader.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/renderer/tr_shader.c	2006-05-06 13:20:41.000000000 +0200
@@ -92,7 +92,7 @@
 
 	// remap all the shaders with the given name
 	// even tho they might have different lightmaps
-	COM_StripExtension( shaderName, strippedName );
+	COM_StripExtension(shaderName, strippedName, sizeof(strippedName));
 	hash = generateHashValue(strippedName, FILE_HASH_SIZE);
 	for (sh = hashTable[hash]; sh; sh = sh->next) {
 		if (Q_stricmp(sh->name, strippedName) == 0) {
@@ -2351,7 +2351,7 @@
 		return tr.defaultShader;
 	}
 
-	COM_StripExtension( name, strippedName );
+	COM_StripExtension(name, strippedName, sizeof(strippedName));
 
 	hash = generateHashValue(strippedName, FILE_HASH_SIZE);
 
@@ -2419,7 +2419,7 @@
 		lightmapIndex = LIGHTMAP_BY_VERTEX;
 	}
 
-	COM_StripExtension( name, strippedName );
+	COM_StripExtension(name, strippedName, sizeof(strippedName));
 
 	hash = generateHashValue(strippedName, FILE_HASH_SIZE);
 
diff -Naur quake3-1.32b.orig/code/ui/ui_main.c quake3-1.32b/code/ui/ui_main.c
--- quake3-1.32b.orig/code/ui/ui_main.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/ui/ui_main.c	2006-05-06 13:20:41.000000000 +0200
@@ -4958,7 +4958,7 @@
 	int		numfiles;
 	char	dirlist[2048];
 	char	filelist[2048];
-	char	skinname[64];
+	char	skinname[MAX_QPATH];
 	char	scratch[256];
 	char*	dirptr;
 	char*	fileptr;
@@ -4988,7 +4988,7 @@
 		{
 			filelen = strlen(fileptr);
 
-			COM_StripExtension(fileptr,skinname);
+			COM_StripExtension(fileptr, skinname, sizeof(skinname));
 
 			// look for icon_????
 			if (Q_stricmpn(skinname, "icon_", 5) == 0 && !(Q_stricmp(skinname,"icon_blue") == 0 || Q_stricmp(skinname,"icon_red") == 0))
diff -Naur quake3-1.32b.orig/code/ui/ui_players.c quake3-1.32b/code/ui/ui_players.c
--- quake3-1.32b.orig/code/ui/ui_players.c	2005-08-16 01:10:07.000000000 +0200
+++ quake3-1.32b/code/ui/ui_players.c	2006-05-06 13:20:41.000000000 +0200
@@ -90,13 +90,13 @@
 
 	if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
 		strcpy( path, item->world_model[0] );
-		COM_StripExtension( path, path );
+		COM_StripExtension(path, path, sizeof(path));
 		strcat( path, "_barrel.md3" );
 		pi->barrelModel = trap_R_RegisterModel( path );
 	}
 
 	strcpy( path, item->world_model[0] );
-	COM_StripExtension( path, path );
+	COM_StripExtension(path, path, sizeof(path));
 	strcat( path, "_flash.md3" );
 	pi->flashModel = trap_R_RegisterModel( path );
 

