* src/mcs51/gen.c (emitcode): fixed bug #992819
[fw/sdcc] / src / mcs51 / gen.c
index 4d72ffe4aa7d857afb0ca3244308dbbc729083b2..4cd4e4e3048fea00ede0c5dd8db0d3d5ca0a9691 100644 (file)
@@ -126,13 +126,13 @@ emitcode (char *inst, const char *fmt,...)
   if (inst && *inst)
     {
       if (fmt && *fmt)
-        sprintf (lb, "%s\t", inst);
+        SNPRINTF (lb, sizeof(lb), "%s\t", inst);
       else
-        sprintf (lb, "%s", inst);
-      vsprintf (lb + (strlen (lb)), fmt, ap);
+        SNPRINTF (lb, sizeof(lb), "%s", inst);
+      tvsprintf (lb + strlen(lb), sizeof(lb) - strlen(lb), fmt, ap);
     }
   else
-    vsprintf (lb, fmt, ap);
+    tvsprintf (lb, sizeof(lb), fmt, ap);
 
   while (isspace (*lbp))
     lbp++;