mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 21:45:12 +00:00
fix version string buffer overflow (#327)
This commit is contained in:
parent
01a81fc6f5
commit
c22eb8b2ba
2 changed files with 6 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
static char sVersionString[MAX_VERSION_LENGTH] = { 0 };
|
||||||
static char sLocalVersionString[MAX_VERSION_LENGTH] = { 0 };
|
static char sLocalVersionString[MAX_LOCAL_VERSION_LENGTH] = { 0 };
|
||||||
|
|
||||||
char* get_version(void) {
|
char* get_version(void) {
|
||||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER);
|
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER);
|
||||||
|
@ -11,6 +11,9 @@ char* get_version(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_version_local(void) {
|
char* get_version_local(void) {
|
||||||
|
if (PATCH_VERSION_NUMBER <= 0) {
|
||||||
|
return get_version();
|
||||||
|
}
|
||||||
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "%s %d.%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER);
|
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "%s %d.%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER);
|
||||||
return sLocalVersionString;
|
return sLocalVersionString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
#define VERSION_TEXT "beta"
|
#define VERSION_TEXT "beta"
|
||||||
#define VERSION_NUMBER 32
|
#define VERSION_NUMBER 32
|
||||||
#define MINOR_VERSION_NUMBER 0
|
#define MINOR_VERSION_NUMBER 0
|
||||||
#define PATCH_VERSION_NUMBER 2
|
#define PATCH_VERSION_NUMBER 3
|
||||||
|
|
||||||
#define MAX_VERSION_LENGTH 10
|
#define MAX_VERSION_LENGTH 10
|
||||||
#define MAX_LOCAL_VERSION_LENGTH 12
|
#define MAX_LOCAL_VERSION_LENGTH 11
|
||||||
char* get_version(void);
|
char* get_version(void);
|
||||||
char* get_version_local(void);
|
char* get_version_local(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue