mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Geoip: Fix possible buffer overflow.
This commit is contained in:
parent
17e0ab99e6
commit
67bfe6bb36
@ -102,7 +102,7 @@ const char *lookupString(const char *ip, const char **path, int *length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Let's avoid a crash in case we go over the buffer size.
|
// Let's avoid a crash in case we go over the buffer size.
|
||||||
size_t maxLength = ke::Min((size_t)result.data_size, sizeof(buffer));
|
size_t maxLength = ke::Min((size_t)result.data_size, sizeof(buffer)-1);
|
||||||
|
|
||||||
// Strings from database are not null terminated.
|
// Strings from database are not null terminated.
|
||||||
memcpy(buffer, result.utf8_string, maxLength);
|
memcpy(buffer, result.utf8_string, maxLength);
|
||||||
|
Loading…
Reference in New Issue
Block a user