Chameleon

Chameleon Commit Details

Date:2010-08-29 13:37:45 (8 years 10 months ago)
Author:Tamás Kosárszky
Commit:444
Parents: 443
Message:Fixed calling getBootVolumeDescription() with properly adjusted strMaxLen values. Removed broken optionKey setting. Now using strncat() for adding proper NULL termination in destination strings.
Changes:
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/disk.c
M/trunk/i386/boot2/options.c

File differences

trunk/i386/libsaio/disk.c
16951695
16961696
16971697
1698
1698
16991699
17001700
17011701
......
17661766
17671767
17681768
1769
1770
1769
17711770
17721771
17731772
bool matchVolumeToString( BVRef bvr, const char* match, long matchLen)
{
char testStr[128];
if ( !bvr || !match || !*match)
return 0;
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;
trunk/i386/boot2/boot.c
401401
402402
403403
404
405
404
406405
407406
408407
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));
}
}
trunk/i386/boot2/options.c
111111
112112
113113
114
114
115115
116116
117117
......
770770
771771
772772
773
774
773
774
775775
776776
777777
778778
779
780
781
779
780
782781
783782
784
783
785784
786785
787786
788
789787
790788
791789
792790
793
794
795791
796792
797793
......
806802
807803
808804
809
805
810806
811807
812808
......
858854
859855
860856
861
857
862858
863859
864860
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 );
// 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;
key = optionKey;
}
if (cnt) {
if (prompt != NULL) {
free(prompt);
}
// 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;

Archive Download the corresponding diff file

Revision: 444