Fix buffer length with coopnet description (#192)
* Make coopnet description length use a variable, and fix crash * move desc length define to top
This commit is contained in:
parent
c0c2352617
commit
cf3fc87789
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
uint64_t gCoopNetDesiredLobby = 0;
|
uint64_t gCoopNetDesiredLobby = 0;
|
||||||
char gCoopNetPassword[64] = "";
|
char gCoopNetPassword[64] = "";
|
||||||
char sCoopNetDescription[512] = "";
|
char sCoopNetDescription[MAX_COOPNET_DESCRIPTION_LENGTH] = "";
|
||||||
|
|
||||||
static uint64_t sLocalLobbyId = 0;
|
static uint64_t sLocalLobbyId = 0;
|
||||||
static uint64_t sLocalLobbyOwnerId = 0;
|
static uint64_t sLocalLobbyOwnerId = 0;
|
||||||
|
@ -176,7 +176,7 @@ bool ns_coopnet_is_connected(void) {
|
||||||
|
|
||||||
static void coopnet_populate_description(void) {
|
static void coopnet_populate_description(void) {
|
||||||
char* buffer = sCoopNetDescription;
|
char* buffer = sCoopNetDescription;
|
||||||
int bufferLength = 1024;
|
int bufferLength = MAX_COOPNET_DESCRIPTION_LENGTH;
|
||||||
// get version
|
// get version
|
||||||
const char* version = get_version_online();
|
const char* version = get_version_online();
|
||||||
int versionLength = strlen(version);
|
int versionLength = strlen(version);
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define COOPNET_H
|
#define COOPNET_H
|
||||||
#ifdef COOPNET
|
#ifdef COOPNET
|
||||||
|
|
||||||
|
#define MAX_COOPNET_DESCRIPTION_LENGTH 1024
|
||||||
|
|
||||||
typedef void (*QueryCallbackPtr)(uint64_t aLobbyId, uint64_t aOwnerId, uint16_t aConnections, uint16_t aMaxConnections, const char* aGame, const char* aVersion, const char* aHostName, const char* aMode, const char* aDescription);
|
typedef void (*QueryCallbackPtr)(uint64_t aLobbyId, uint64_t aOwnerId, uint16_t aConnections, uint16_t aMaxConnections, const char* aGame, const char* aVersion, const char* aHostName, const char* aMode, const char* aDescription);
|
||||||
typedef void (*QueryFinishCallbackPtr)(void);
|
typedef void (*QueryFinishCallbackPtr)(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue