From d7e86422366e861f3849700edf8565b368704992 Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Tue, 13 Apr 2021 00:33:06 +0200 Subject: [PATCH 1/2] Discord Invite Fixes + DUMPCONSISTENCY flag for makefile --- src/Makefile | 4 ++++ src/discord.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index da96f0cf..6ea7fd78 100644 --- a/src/Makefile +++ b/src/Makefile @@ -515,6 +515,10 @@ ifdef ZDEBUG CPPFLAGS+=-DZDEBUG endif +ifdef DUMPCONSISTENCY + CPPFLAGS+=-DDUMPCONSISTENCY +endif + ifdef DEVELOP CPPFLAGS+=-DDEVELOP endif diff --git a/src/discord.c b/src/discord.c index db0ea344..e6eabf9a 100644 --- a/src/discord.c +++ b/src/discord.c @@ -361,7 +361,7 @@ static const char *DRPC_GetServerIP(void) { // We're not the server, so we could successfully get the IP! // No need to do anything else :) - sprintf(self_ip, "%s:%u", address, current_port); + strcpy(self_ip, address); return self_ip; } } @@ -461,10 +461,7 @@ void DRPC_UpdatePresence(void) // Grab the host's IP for joining. if ((join = DRPC_GetServerIP()) != NULL) { - char *xorjoin = DRPC_XORIPString(join); - discordPresence.joinSecret = xorjoin; - free(xorjoin); - + discordPresence.joinSecret = DRPC_XORIPString(join); joinSecretSet = true; } } From ea56bd472c1426ad1f4f6835f3ca365bc9f22f1d Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Tue, 13 Apr 2021 06:56:14 +0200 Subject: [PATCH 2/2] Simply return address, don't allow self_ip to be possibly written as something else --- src/discord.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/discord.c b/src/discord.c index e6eabf9a..ba68da72 100644 --- a/src/discord.c +++ b/src/discord.c @@ -361,8 +361,7 @@ static const char *DRPC_GetServerIP(void) { // We're not the server, so we could successfully get the IP! // No need to do anything else :) - strcpy(self_ip, address); - return self_ip; + return address; } }