]> Shamusworld >> Repos - rmac/blobdiff - rmac.c
Fixes for bugs #211-213, submitted by Bastian Schick. :-)
[rmac] / rmac.c
diff --git a/rmac.c b/rmac.c
index 8e5f4102ce8af450dde2e8cc64ed3abf8e84b225..17715f7ad6c86e8f9f0c6cffced6920e7b76ae00 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -758,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;
        }