Index: branches/ErmaC/Enoch/i386/libsaio/ntfs.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/ntfs.c (revision 2502) +++ branches/ErmaC/Enoch/i386/libsaio/ntfs.c (revision 2503) @@ -313,6 +313,7 @@ { return -1; } + bzero(buf,MAX_BLOCK_SIZE); /* * Read the boot sector, check signatures, and do some minimal @@ -329,12 +330,14 @@ if ( memcmp((void*)boot->bf_sysid, NTFS_BBID, NTFS_BBIDLEN) != 0 ) { // If not NTFS, maybe it is EXFAT + free(buf); return EXFATGetUUID(ih, uuidStr); } // Check for non-null volume serial number if( !boot->bf_volsn ) { + free(buf); return -1; } Index: branches/ErmaC/Enoch/i386/libsaio/sys.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2502) +++ branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2503) @@ -926,6 +926,10 @@ { for ( bvr = chain; bvr; bvr = bvr->next ) { + if (!bvr) + { + break; + } if ( bvr->part_no == multiboot_partition && bvr->biosdev == gBIOSDev ) { return bvr; @@ -943,6 +947,10 @@ { for ( bvr = chain; bvr; bvr = bvr->next ) { + if (!bvr) + { + break; + } if (matchVolumeToString(bvr, val, false)) { free(val); @@ -960,6 +968,10 @@ */ for ( bvr = chain; bvr; bvr = bvr->next ) { + if (!bvr) + { + break; + } if (multiboot_skip_partition_set) { if (bvr->part_no == multiboot_skip_partition) @@ -999,6 +1011,10 @@ { for ( bvr = chain; bvr; bvr = bvr->next ) { + if (!bvr) + { + break; + } if ( bvr->flags & kBVFlagNativeBoot && bvr->biosdev == gBIOSDev ) { bvr1 = bvr; Index: branches/ErmaC/Enoch/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2502) +++ branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2503) @@ -1766,6 +1766,10 @@ void rescanBIOSDevice(int biosdev) { struct DiskBVMap *oldMap = diskResetBootVolumes(biosdev); + if (oldMap == NULL) + { + return; + } CacheReset(); diskFreeMap(oldMap); oldMap = NULL; @@ -1798,7 +1802,8 @@ } else { - stop(""); + stop("diskResetBootVolumes error\n"); + return NULL; } } // Return the old map, either to be freed, or reinserted later @@ -1934,6 +1939,8 @@ { continue; } + bzero(newBVR,sizeof(*newBVR)); + bcopy(bvr, newBVR, sizeof(*newBVR)); /* @@ -1996,6 +2003,10 @@ #if DEBUG //Azi: warning - too big for boot-log.. far too big.. i mean HUGE!! :P for (bvr = chain; bvr; bvr = bvr->next) { + if (!bvr) + { + break; + } printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible); } printf("count: %d\n", bvCount); @@ -2018,6 +2029,10 @@ while (bvr) { + if (!bvr) + { + break; + } nextBVR = bvr->next; if (bvr->filtered) Index: branches/ErmaC/Enoch/CHANGES =================================================================== --- branches/ErmaC/Enoch/CHANGES (revision 2502) +++ branches/ErmaC/Enoch/CHANGES (revision 2503) @@ -1,3 +1,4 @@ +- cparm : Merge (security, stability, bugs fixes) improvements. - Zenith432 : Completed patch for ExFAT support ( http://www.insanelymac.com/forum/topic/302938-exfat-volume-boot-record-for-chameleon ) - Zenith432 : add EXFAT boot support by Zenith432 - zenith432 : Merge patch from issue 386 (boot2 does not know how to read files from FAT partitions on GPT)