2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-02-04 17:50:36 +03:00

Bugfix Info_ValueForKey: Fix wrong comparison

This commit is contained in:
s1lent 2018-05-06 13:33:38 +07:00
parent f324df867f
commit 2fa7655370
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
2 changed files with 4 additions and 4 deletions

View File

@ -105,7 +105,7 @@
extern char g_szEXEName[ 4096 ];
#define _snprintf snprintf
#if defined(OSX)
#define SO_ARCH_SUFFIX ".dylib"
#else

View File

@ -73,6 +73,7 @@ const char* EXT_FUNC Info_ValueForKey(const char *s, const char *lookup)
static char valueBuf[INFO_MAX_BUFFER_VALUES][MAX_KV_LEN];
static int valueIndex;
size_t lookupLen = Q_strlen(lookup);
while (*s == '\\')
{
// skip starting slash
@ -87,7 +88,6 @@ const char* EXT_FUNC Info_ValueForKey(const char *s, const char *lookup)
s++;
}
size_t keyLen = s - key;
const char* value = ++s; // skip separating slash
// skip value
@ -96,7 +96,7 @@ const char* EXT_FUNC Info_ValueForKey(const char *s, const char *lookup)
size_t valueLen = Q_min(s - value, MAX_KV_LEN - 1);
if (!Q_strncmp(key, lookup, keyLen))
if (!Q_strncmp(key, lookup, lookupLen))
{
char* dest = valueBuf[valueIndex];
Q_memcpy(dest, value, valueLen);
@ -865,7 +865,7 @@ qboolean Info_IsValid(const char *s)
// key should end with a '\', not a NULL
if (*s == '\0')
return FALSE;
// quotes are deprecated
if (*s == '"')
return FALSE;