sprintf -> snprintf
This commit is contained in:
parent
0cd761808a
commit
0f60ac2dd7
1 changed files with 3 additions and 3 deletions
|
|
@ -169,14 +169,14 @@ static void matchCallback(void* context UNUSED,
|
||||||
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
if (vendor && product)
|
if (vendor && product)
|
||||||
{
|
{
|
||||||
sprintf(guid, "03000000%02x%02x0000%02x%02x0000%02x%02x0000",
|
snprintf(guid, sizeof(guid), "03000000%02x%02x0000%02x%02x0000%02x%02x0000",
|
||||||
(uint8_t) vendor, (uint8_t) (vendor >> 8),
|
(uint8_t) vendor, (uint8_t) (vendor >> 8),
|
||||||
(uint8_t) product, (uint8_t) (product >> 8),
|
(uint8_t) product, (uint8_t) (product >> 8),
|
||||||
(uint8_t) version, (uint8_t) (version >> 8));
|
(uint8_t) version, (uint8_t) (version >> 8));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
|
snprintf(guid, sizeof(guid), "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
|
||||||
name[0], name[1], name[2], name[3],
|
name[0], name[1], name[2], name[3],
|
||||||
name[4], name[5], name[6], name[7],
|
name[4], name[5], name[6], name[7],
|
||||||
name[8], name[9], name[10]);
|
name[8], name[9], name[10]);
|
||||||
|
|
@ -476,7 +476,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||||
{
|
{
|
||||||
char original[33];
|
char original[33];
|
||||||
strncpy(original, guid, sizeof(original) - 1);
|
strncpy(original, guid, sizeof(original) - 1);
|
||||||
sprintf(guid, "03000000%.4s0000%.4s000000000000",
|
snprintf(guid, 33, "03000000%.4s0000%.4s000000000000",
|
||||||
original, original + 16);
|
original, original + 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue