Ignore:
Timestamp:
Jun 19, 2009, 9:10:17 PM (15 years ago)
Author:
Bruno Cornec
Message:

Fix a bug (seg fault) when a too large mountlist was used. Increased MAXIMUM_DISKS_PER_RAID_DEV which serve as table allocation for drivelist, which should be as big as mountlist in fact ! (which it is still not, but is now sufficently large to be correct). Again dynamic memory allocation is the solution. Or perl ;-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-mountlist.c

    r2236 r2237  
    678678        log_msg(8, "Putting %s with size %lli in list of drives", drive, size);
    679679
     680        /* memory allocation */
    680681        truncdrive = truncate_to_drive_name(drive);
     682        paranoid_free(drive);
     683
    681684        log_msg(8, "drive truncated to %s", truncdrive);
    682685
     
    687690        }
    688691        if (j == noof_drives) {
    689             strncpy(drivelist->el[noof_drives].device, drive, 63);
     692            strncpy(drivelist->el[noof_drives].device, truncdrive, 63);
    690693            drivelist->el[noof_drives].device[63] = '\0';
    691694            log_msg(8,"Adding drive %s to list", drivelist->el[noof_drives].device);
    692695            noof_drives++;
    693696        }
    694         paranoid_free(drive);
    695697        paranoid_free(truncdrive);
     698        if (noof_drives >= MAXIMUM_DISKS_PER_RAID_DEV) {
     699            log_msg(0, "Unable to handle mountlist with more than %d lines", MAXIMUM_DISKS_PER_RAID_DEV);
     700            log_to_screen("Unable to handle a so big mountlist");
     701            finish(1);
     702        }
    696703    }
    697704    drivelist->entries = noof_drives;
Note: See TracChangeset for help on using the changeset viewer.