aboutsummaryrefslogtreecommitdiffhomepage
path: root/osdep
diff options
context:
space:
mode:
authorGravatar Rodger Combs <rodger.combs@gmail.com>2018-07-01 04:56:08 -0500
committerGravatar Jan Ekström <jeebjp@gmail.com>2018-10-02 00:20:43 +0300
commit1842a932d37638c910f4471d85e81554076c3d2c (patch)
treec536f9ab1b352530dce85e7cb38c4f1a8407db7d /osdep
parentada4f7c6006fc60189987b3ee012e7f4ced9926e (diff)
{mac,cocoa}: trim trailing null out of macosx_icon when loading it
This prevents crashes when loading the application icon image. Suggested-by: Akemi <der.richter@gmx.de>
Diffstat (limited to 'osdep')
-rw-r--r--osdep/macosx_application.m3
1 files changed, 2 insertions, 1 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index ca613e04f4..086d51fef3 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -127,8 +127,9 @@ static const char macosx_icon[] =
- (NSImage *)getMPVIcon
{
+ // The C string contains a trailing null, so we strip it away
NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)macosx_icon
- length:sizeof(macosx_icon)
+ length:sizeof(macosx_icon) - 1
freeWhenDone:NO];
return [[NSImage alloc] initWithData:icon_data];
}