I believe I have found the problem and (I hope) a fix. Sorry for
spamming everyone's inbox today.

The problem seems to stem from the strcpy() command overflowing when
copying one character into a two-character string. It seems as though
GCC is treating the characters in the source string as being larger than
one byte each, so to great around the overflow I've increased the size
of the destination buffer.

I've tested this using GCC 4.6 and GCC 4.7 and both are giving me
executables that run okay.

Attached I've included a patch. Please apply it to src/atanks.cpp and
let me know if it works. Assuming this fixes the issue I'll include the
patch in the next release of Atanks.

--- atanks.cpp.orig	2012-10-22 12:36:55.000000000 -0300
+++ atanks.cpp	2012-10-22 12:37:52.000000000 -0300
@@ -1008,6 +1008,7 @@
 int options (GLOBALDATA *global, ENVIRONMENT *env, MENUDESC *menu)
 {
   MENUENTRY *opts;
+  char my_pointer[32];
   BUTTON *reset_button = NULL;
   int selected_index = 0, my_key = 0;
   int numEntries;
@@ -1315,8 +1316,7 @@
             {
               int midX = opts[z].x;
               int midY = opts[z].y;
-              char my_pointer[2];
-  
+
               if (z == selected_index)
                   strcpy(my_pointer, "*");
               else

Reply via email to