View Issue Details

IDProjectCategoryView StatusLast Update
0002520FSSCPPlatform-Engine interactionpublic2011-10-16 06:12
ReporterComputerDruid Assigned ToEchelon9  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version3.6.13 
Summary0002520: r7905 crashes when no -keyboard_layout is specified
Descriptionr7905 introduced the new -keyboard_layout option. However, when not specified, it causes strcmp to be called on a null pointer, which causes a segfault on my system/optimizations (Linux x86_64)
Additional InformationRecommend to first check if the option is specified before running strcmp.

Please see attached patch.
TagsNo tags attached.

Activities

2011-10-15 14:44

 

fix-strcmp.patch (469 bytes)   
diff --git a/code/io/key.cpp b/code/io/key.cpp
index 15b05bf..c3582b8 100644
--- a/code/io/key.cpp
+++ b/code/io/key.cpp
@@ -115,8 +115,10 @@ void FillSDLArray ()
 {
 	KeyboardLayout layout = KEYBOARD_LAYOUT_DEFAULT;
 
-	if (!strcmp(Cmdline_keyboard_layout, "qwertz")) {
-		layout = KEYBOARD_LAYOUT_QWERTZ;
+	if (Cmdline_keyboard_layout) {
+		if (!strcmp(Cmdline_keyboard_layout, "qwertz")) {
+			layout = KEYBOARD_LAYOUT_QWERTZ;
+		}
 	}
 
 	SDLtoFS2[SDLK_0] = KEY_0;
fix-strcmp.patch (469 bytes)   

Echelon9

2011-10-16 06:12

developer   ~0012893

Fixed in a similar, but not quite the same, way in http://svn.icculus.org/fs2open?view=rev&revision=7906

Issue History

Date Modified Username Field Change
2011-10-15 14:44 ComputerDruid New Issue
2011-10-15 14:44 ComputerDruid File Added: fix-strcmp.patch
2011-10-16 06:11 Echelon9 Status new => assigned
2011-10-16 06:11 Echelon9 Assigned To => Echelon9
2011-10-16 06:12 Echelon9 Note Added: 0012893
2011-10-16 06:12 Echelon9 Status assigned => resolved
2011-10-16 06:12 Echelon9 Fixed in Version => 3.6.13
2011-10-16 06:12 Echelon9 Resolution open => fixed