Merge pull request #7641 from meepingsnesroms/master

Add NULL check to prevent empty password from crashing RetroArch
This commit is contained in:
Twinaphex 2018-11-25 00:52:03 +01:00 committed by GitHub
commit 8ba1b3f20f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));