Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase max mach service name length to 127 characters #1813

Merged
merged 2 commits into from
Apr 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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