mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 07:13:35 +00:00
Add NULL check to prevent empty password from crashing RetroArch
This commit is contained in:
parent
3a666373b4
commit
bcb4d61510
@ -21,6 +21,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <rhash.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
@ -279,7 +280,8 @@ static void handshake_password(void *ignore, const char *line)
|
||||
struct netplay_connection *connection = &netplay->connections[0];
|
||||
|
||||
snprintf(password, sizeof(password), "%08X", connection->salt);
|
||||
strlcpy(password + 8, line, sizeof(password)-8);
|
||||
if (!string_is_empty(line))
|
||||
strlcpy(password + 8, line, sizeof(password)-8);
|
||||
|
||||
password_buf.cmd[0] = htonl(NETPLAY_CMD_PASSWORD);
|
||||
password_buf.cmd[1] = htonl(sizeof(password_buf.password));
|
||||
|
Loading…
x
Reference in New Issue
Block a user