Þæs Ofereode - nbimage.c.patch
--- bootp-133.6/bootplib/nbimages.c- 2006-02-09 14:03:38.000000000 +0000
+++ bootp-133.6/bootplib/nbimages.c 2006-02-10 10:31:18.000000000 +0000
@@ -83,6 +83,11 @@
myCFStringArrayToCStringArray(CFArrayRef arr, char * buffer, int * buffer_size,
int * ret_count)
{
+ if(isA_CFArray(arr)==NULL)
+ {
+ //we can't continue, this isn't a CFArray
+ return(FALSE);
+ }
int count = CFArrayGetCount(arr);
int i;
char * offset = NULL;
@@ -608,21 +613,29 @@
archlist_prop = CFDictionaryGetValue(plist, kNetBootImageInfoArchitectures);
if (archlist_prop != NULL) {
int archlist_count;
-
+ if (isA_CFArray(archlist_prop)==NULL)
+ {
+ //broken plist entry, assume this is an old PPC-only NBI
+ syslog(LOG_WARNING,"broken NBI plist, assuming old PPC image...");
+ CFMutableArrayRef ppcArray=CFArrayCreateMutable(kCFAllocatorDefault,1,NULL);
+ CFStringRef ppcString=CFSTR("ppc");
+ CFArrayAppendValue(ppcArray,ppcString);
+ archlist_prop=CFArrayCreateCopy(kCFAllocatorDefault,ppcArray);
+ }
if (myCFStringArrayToCStringArray(archlist_prop,
- NULL, &archlist_space,
- &archlist_count) == FALSE) {
- fprintf(stderr,
- "Couldn't calculate Archlist length\n");
- goto failed;
+ NULL, &archlist_space,
+ &archlist_count) == FALSE) {
+ fprintf(stderr,
+ "Couldn't calculate Archlist length\n");
+ goto failed;
}
if (archlist_count == 0) {
- fprintf(stderr,
- "Empty ArchList array");
- goto failed;
+ fprintf(stderr,
+ "Empty ArchList array");
+ goto failed;
}
tail_space += archlist_space;
- }
+ }
bootfile_prop = CFDictionaryGetValue(plist, kNetBootImageInfoBootFile);
Raw Source