Index: branches/danielkza/Chameleon.xcodeproj/project.pbxproj =================================================================== --- branches/danielkza/Chameleon.xcodeproj/project.pbxproj (revision 290) +++ branches/danielkza/Chameleon.xcodeproj/project.pbxproj (revision 291) @@ -10,6 +10,7 @@ 0172D0DC11FB66820030222E /* dram_controllers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = ""; }; 0172D0DD11FB66820030222E /* dram_controllers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = ""; }; 019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = ""; }; + 65ED53931204B83200B22507 /* disk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = ""; }; B0056CD611F3868000754B65 /* boot */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot; sourceTree = ""; }; B0056CD711F3868000754B65 /* boot.sys */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.preload"; path = boot.sys; sourceTree = ""; }; B0056CD811F3868000754B65 /* boot0 */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot0; sourceTree = ""; }; @@ -472,6 +473,7 @@ B0056D2411F3868000754B65 /* libsaio */ = { isa = PBXGroup; children = ( + 65ED53931204B83200B22507 /* disk.h */, B0056D2511F3868000754B65 /* acpi.h */, B0056D2611F3868000754B65 /* acpi_patcher.c */, B0056D2711F3868000754B65 /* acpi_patcher.h */, Index: branches/danielkza/i386/libsaio/xml.c =================================================================== --- branches/danielkza/i386/libsaio/xml.c (revision 290) +++ branches/danielkza/i386/libsaio/xml.c (revision 291) @@ -110,13 +110,13 @@ return 0; } -/* Function for basic XML entity replacement. It *does not* handle unicode escapes */ +/* Function for basic XML character entities parsing */ char* XMLDecode(const char* src) { typedef const struct XMLEntity { - char* name; + const char* name; size_t nameLen; char value; } XMLEntity; @@ -143,13 +143,12 @@ if ( *s == '&' ) { bool entFound = false; - XMLEntity* ent; - int i = 0; + int i; s++; - for ( ent=&ents[0]; i < sizeof(ents); ent = &ents[i++] ) + for ( i = 0; i < sizeof(ents); i++) { - if ( strncmp(s, ent->name, ent->nameLen) == 0 ) + if ( strncmp(s, ents[i].name, ents[i].nameLen) == 0 ) { entFound = true; break; @@ -157,8 +156,8 @@ } if ( entFound ) { - *o++ = ent->value; - s += ent->nameLen; + *o++ = ents[i].value; + s += ents[i].nameLen; continue; } } Index: branches/danielkza/i386/libsaio/sys.c =================================================================== --- branches/danielkza/i386/libsaio/sys.c (revision 290) +++ branches/danielkza/i386/libsaio/sys.c (revision 291) @@ -813,7 +813,6 @@ bool filteredChain = false; bool foundPrimary = false; BVRef bvr, bvr1 = 0, bvr2 = 0; - extern bool matchVolumeToString(BVRRef, const char *, bool); if (chain->filtered) filteredChain = true; Index: branches/danielkza/i386/libsaio/disk.c =================================================================== --- branches/danielkza/i386/libsaio/disk.c (revision 290) +++ branches/danielkza/i386/libsaio/disk.c (revision 291) @@ -68,6 +68,7 @@ #include "ext2fs.h" #include "xml.h" +#include "disk.h" #include #include @@ -1824,7 +1825,7 @@ void getBootVolumeDescription( BVRef bvr, char *str, long strMaxLen, bool verbose ) { unsigned char type; - char*p = str; + char *p = str; if(!bvr || !p || strMaxLen <= 0) return; @@ -1834,8 +1835,12 @@ if (verbose) { int len = getDeviceDescription(bvr, str); - strcat(str, " "); - for (; strMaxLen > 0 && *p != '\0'; p++, strMaxLen--); + if(len >= strMaxLen) + return; + + strcpy(str[len++], " "); + strMaxLen -= len; + p += len; } /* See if a partition rename is preferred */ Index: branches/danielkza/i386/libsaio/disk.h =================================================================== --- branches/danielkza/i386/libsaio/disk.h (revision 290) +++ branches/danielkza/i386/libsaio/disk.h (revision 291) @@ -11,18 +11,4 @@ char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial); -#endif /* __LIBSAIO_DISK_H */ -/* - * disk.h - * Chameleon - * - * Created by Daniel Miranda on 27/07/10. - * Copyright 2010 __MyCompanyName__. All rights reserved. - * - */ -#ifndef __LIBSAIO_DISK_H -#define __LIBSAIO_DISK_H - -char* matchVolumeToString( BVRef bvr, const char* match, bool matchPartial); - -#endif /* __LIBSAIO_DISK_H */ +#endif /* __LIBSAIO_DISK_H */ \ No newline at end of file Index: branches/danielkza/i386/boot2/options.c =================================================================== --- branches/danielkza/i386/boot2/options.c (revision 290) +++ branches/danielkza/i386/boot2/options.c (revision 291) @@ -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, 79, true ); + getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy)-1, true ); drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, false ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); @@ -777,7 +777,7 @@ strlcpy(prompt, val, cnt); } else { name = malloc(80); - getBootVolumeDescription(gBootVolume, name, 79, false); + getBootVolumeDescription(gBootVolume, name, sizeof(name)-1, false); prompt = malloc(256); sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); Index: branches/danielkza/i386/libsa/printf.c =================================================================== --- branches/danielkza/i386/libsa/printf.c (revision 290) +++ branches/danielkza/i386/libsa/printf.c (revision 291) @@ -60,6 +60,20 @@ return (pi.str - str); } +int snprintf(char *str, long len, const char * fmt, ...) +{ + va_list ap; + struct putc_info pi; + + va_start(ap, fmt); + pi.str = str; + pi.last_str = str + len - 1; + prf(fmt, ap, sputc, &pi); + *pi.str = '\0'; + va_end(ap); + return (pi.str - str); +} + /*VARARGS1*/ int slvprintf(char * str, int len, const char * fmt, va_list ap) {