Index: trunk/i386/libsaio/disk.c =================================================================== --- trunk/i386/libsaio/disk.c (revision 443) +++ trunk/i386/libsaio/disk.c (revision 444) @@ -1695,7 +1695,7 @@ bool matchVolumeToString( BVRef bvr, const char* match, long matchLen) { char testStr[128]; - + if ( !bvr || !match || !*match) return 0; @@ -1766,8 +1766,7 @@ if ( matchVolumeToString(bvr, volStart, volLen) ) { - strncpy(str, aliasStart, min(strMaxLen, aliasLen)); - str[min(strMaxLen, aliasLen)] = '\0'; + strncat(str, aliasStart, min(strMaxLen, aliasLen)); free(aliasList); return true; Index: trunk/i386/boot2/boot.c =================================================================== --- trunk/i386/boot2/boot.c (revision 443) +++ trunk/i386/boot2/boot.c (revision 444) @@ -401,8 +401,7 @@ if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) { // getValueForKey uses const char for val // so copy it and trim - strncpy(gMacOSVersion, val, MIN(len, 4)); - gMacOSVersion[MIN(len, 4)] = '\0'; + strncat(gMacOSVersion, val, MIN(len, 4)); } } Index: trunk/i386/boot2/options.c =================================================================== --- trunk/i386/boot2/options.c (revision 443) +++ trunk/i386/boot2/options.c (revision 444) @@ -111,7 +111,7 @@ position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) ); char dummy[80]; - getBootVolumeDescription( gBootVolume, dummy, 80, true ); + getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true ); drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); @@ -770,28 +770,24 @@ // When booting from CD, default to hard drive boot when possible. if (isCDROM && firstRun) { const char *val; - char *prompt; - char *name; + char *prompt = NULL; + char *name = NULL; int cnt; int optionKey; if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) { - cnt += 1; - prompt = malloc(cnt); - strlcpy(prompt, val, cnt); + prompt = malloc(cnt + 1); + strncat(prompt, val, cnt); } else { name = malloc(80); - getBootVolumeDescription(gBootVolume, name, 80, false); + getBootVolumeDescription(gBootVolume, name, 79, false); prompt = malloc(256); sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); - cnt = 0; } if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->bootConfig )) { // The key specified is a special key. - } else if (getValueForKey( kCDROMOptionKey, &val, &cnt, &bootInfo->bootConfig ) && cnt >= 1) { - optionKey = val[0]; } else { // Default to F8. optionKey = 0x4200; @@ -806,7 +802,7 @@ key = optionKey; } - if (cnt) { + if (prompt != NULL) { free(prompt); } @@ -858,7 +854,7 @@ // Associate a menu item for each BVRef. for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) { if (bvr->visible) { - getBootVolumeDescription(bvr, menuItems[i].name, 80, true); + getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[i].name) - 1, true); menuItems[i].param = (void *) bvr; if (bvr == menuBVR) { selectIndex = i;