File bochs-strncat.patch of Package bochs

--- gui/textconfig.cc
+++ gui/textconfig.cc
@@ -787,11 +787,8 @@
     char sep_string[2];
     sep_string[0] = separator;
     sep_string[1] = 0;
-    for (int i=0; i<maxsize; i++) {
-      char eachbyte[16];
-      sprintf (eachbyte, "%s%02x", (i>0)?sep_string : "", (unsigned int)0xff&val[i]);
-      strncat (buffer, eachbyte, sizeof(buffer));
-    }
+    for (int i=0; i<maxsize; i++)
+      snprintf (buffer+strlen(buffer),sizeof(buffer)-strlen(buffer)-1, "%s%02x", (i>0)?sep_string : "", (unsigned int)0xff&val[i]);
     if (strlen (buffer) > sizeof(buffer)-4) {
       assert (0); // raw byte print buffer is probably overflowing. increase the max or make it dynamic
     }
openSUSE Build Service is sponsored by