File caprice32-overflow.patch of Package caprice32

--- cap32.cpp
+++ cap32.cpp
@@ -2491,7 +2491,7 @@
    dword dwFlags;
 
    memset(&sh, 0, sizeof(sh));
-   strcpy(sh.id, "MV - SNA");
+   strncpy(sh.id, "MV - SNA", 8);
    sh.version = 3;
 // Z80
    sh.AF[1] = _A;
@@ -2831,7 +2831,7 @@
 
    if ((pfileObject = fopen(pchFileName, "wb")) != NULL) {
       memset(&dh, 0, sizeof(dh));
-      strcpy(dh.id, "EXTENDED CPC DSK File\r\nDisk-Info\r\n");
+      strncpy(dh.id, "EXTENDED CPC DSK File\r\nDisk-Info\r\n", 34);
       strcpy(dh.unused1, "Caprice32\r\n");
       dh.tracks = drive->tracks;
       dh.sides = (drive->sides+1) | (drive->random_DEs); // correct side count and indicate random DEs, if necessary
@@ -2850,7 +2850,7 @@
       }
 
       memset(&th, 0, sizeof(th));
-      strcpy(th.id, "Track-Info\r\n");
+      strncpy(th.id, "Track-Info\r\n", 12);
       for (track = 0; track < drive->tracks; track++) { // loop for all tracks
          for (side = 0; side <= drive->sides; side++) { // loop for all sides
             if (drive->track[track][side].size) { // track is formatted?
openSUSE Build Service is sponsored by