Skip to content

Commit

Permalink
Merge pull request #1813 from sparkle-project/service-length
Browse files Browse the repository at this point in the history
Increase max mach service name length to 127 characters
  • Loading branch information
zorgiepoo authored Apr 4, 2021
2 parents a79aa16 + 71a36f8 commit faf047c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
7 changes: 3 additions & 4 deletions Autoupdate/SPUMessageTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

NS_ASSUME_NONNULL_BEGIN

@class SUHost;

extern NSString *SPUAppcastItemArchiveKey;

// Order matters; higher stages have higher values.
typedef NS_ENUM(int32_t, SPUInstallerMessageType)
{
Expand All @@ -40,10 +36,13 @@ typedef NS_ENUM(int32_t, SPUUpdaterMessageType)

BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType);

// Used by framework to communicate to installer (Autoupdate)
NSString *SPUInstallerServiceNameForBundleIdentifier(NSString *bundleIdentifier);

// Used by framework to communicate to progress agent tool (Updater)
NSString *SPUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier);

// Used by progress agent tool to communicate to installer (Autoupdate)
NSString *SPUProgressAgentServiceNameForBundleIdentifier(NSString *bundleIdentifier);

NS_ASSUME_NONNULL_END
13 changes: 4 additions & 9 deletions Autoupdate/SPUMessageTypes.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,19 @@
//

#import "SPUMessageTypes.h"
#import "SUHost.h"


#include "AppKitPrevention.h"

NSString *SPUAppcastItemArchiveKey = @"SPUAppcastItemArchive";

// Tags added to the bundle identifier which is used as Mach service names
// These should be very short because length restrictions exist on earlier versions of macOS
// These should be very short because of length restrictions
#define SPARKLE_INSTALLER_TAG @"-spki"
#define SPARKLE_STATUS_TAG @"-spks"
#define SPARKLE_PROGRESS_TAG @"-spkp"
#define SPARKLE_PROGRESS_LAUNCH_INSTALLER_TAG @"-spkl"

// macOS 10.8 at least can't handle service names that are 64 characters or longer
// This was fixed some point after 10.8, but I'm not sure if it was fixed in 10.9 or 10.10 or 10.11
// If we knew when it was fixed, this could only be relevant to OS versions prior to that
#define MAX_SERVICE_NAME_LENGTH 63u
// macOS 10.8 couldn't handle service names that are >= 64 characters,
// but 10.9 raised this to >= 128 characters
#define MAX_SERVICE_NAME_LENGTH 127u

BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType)
{
Expand Down

0 comments on commit faf047c

Please sign in to comment.