From 87aba4b02e0ba05092be371a2ae26985163a0885 Mon Sep 17 00:00:00 2001 From: balr0g Date: Thu, 9 Aug 2012 08:17:09 -0400 Subject: [PATCH 1/2] Fix /sysinfo truncation --- Resources/Plugins/System Profiler/TPI_SP_SysInfo.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m b/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m index 9dbe2d422e..30bdb13828 100755 --- a/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m +++ b/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m @@ -509,7 +509,8 @@ + (NSString *)graphicsCardInfo if (PointerIsNotEmpty(model)) { if (CFGetTypeID(model) == CFDataGetTypeID()) { - NSString *s = [NSString stringWithData:(__bridge NSData *)model encoding:NSASCIIStringEncoding]; + NSString *s = [NSString stringWithBytes:[(__bridge NSData *)model bytes] length:(CFDataGetLength(model)-1) + encoding:NSASCIIStringEncoding]; [gpuList addObject:s]; } From 2d9970e6f94ac410d7ad98eef7d193736d45dbbb Mon Sep 17 00:00:00 2001 From: balr0g Date: Thu, 9 Aug 2012 11:57:46 -0400 Subject: [PATCH 2/2] Be sure model isn't empty --- Resources/Plugins/System Profiler/TPI_SP_SysInfo.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m b/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m index 30bdb13828..cc4e32545c 100755 --- a/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m +++ b/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m @@ -508,7 +508,7 @@ + (NSString *)graphicsCardInfo const void *model = CFDictionaryGetValue(serviceDictionary, @"model"); if (PointerIsNotEmpty(model)) { - if (CFGetTypeID(model) == CFDataGetTypeID()) { + if (CFGetTypeID(model) == CFDataGetTypeID() && CFDataGetLength(model) > 1) { NSString *s = [NSString stringWithBytes:[(__bridge NSData *)model bytes] length:(CFDataGetLength(model)-1) encoding:NSASCIIStringEncoding];