From b8887aa01e078cd87c428eae54c470b5347b2e9b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 19 Aug 2019 09:59:16 -0700 Subject: [PATCH] Fix mac launcher not correctly reading interface version The logic to convert the interface output assumed that the output would be null terminated, but it was not. --- launchers/darwin/src/Interface.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/launchers/darwin/src/Interface.m b/launchers/darwin/src/Interface.m index d02b66b581..8dc5d00806 100644 --- a/launchers/darwin/src/Interface.m +++ b/launchers/darwin/src/Interface.m @@ -33,10 +33,11 @@ return 0; } - NSFileHandle * fh = [standardOut fileHandleForReading]; - NSData * data = [fh readDataToEndOfFile]; - NSString * output = [NSString stringWithUTF8String:[data bytes]]; - if (output == nil) { + NSFileHandle* fh = [standardOut fileHandleForReading]; + NSData* data = [fh readDataToEndOfFile]; + + NSString* output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + if (output == nil || [output length] == 0) { NSDictionary * userInfo = @{ NSLocalizedDescriptionKey: NSLocalizedString(@"Couldn't start interface", nil) };