]> Shamusworld >> Repos - rmac/blobdiff - rmac.c
Version bump for last commit. :-)
[rmac] / rmac.c
diff --git a/rmac.c b/rmac.c
index d9158f4c82e63016daa6bd8c4e36655ece011c1d..17715f7ad6c86e8f9f0c6cffced6920e7b76ae00 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -62,6 +62,7 @@ int activefpu = FPU_NONE;             // Active FPU (none by default)
 int org68k_active = 0;                 // .org switch for 68k (only with RAW output format)
 uint32_t org68k_address;               // .org for 68k
 int correctMathRules;                  // 1, use C operator precedence in expressions
+uint32_t used_architectures;   // Bitmask that records exactly which architectures were used during assembly
 
 //
 // Convert a string to uppercase
@@ -377,6 +378,7 @@ int Process(int argc, char ** argv)
        regcheck = reg68check;                  // Idem
        regaccept = reg68accept;                // Idem
     correctMathRules = 0;                      // respect operator precedence
+       used_architectures = 0;                 // Initialise used architectures bitfield
        // Initialize modules
        InitSymbolTable();                              // Symbol table
        InitTokenizer();                                // Tokenizer
@@ -756,7 +758,9 @@ int Process(int argc, char ** argv)
                if (firstfname == NULL)
                        firstfname = defname;
 
-               strcpy(fnbuf, firstfname);
+               // It's the size of fnbuf minus 5 because of the possible 4 char suffix
+               // + trailing null (added by fext()).
+               strncpy(fnbuf, firstfname, sizeof(fnbuf) - 5);
                fext(fnbuf, (prg_flag ? ".prg" : ".o"), 1);
                objfname = fnbuf;
        }