From 58073eeb15fe50dffb31d02a0d0b6bab845351e7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 27 Apr 2019 04:43:07 +0200 Subject: [PATCH] Small cleanup --- network/netplay/netplay_handshake.c | 6 ++++-- tasks/task_image.c | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/network/netplay/netplay_handshake.c b/network/netplay/netplay_handshake.c index dcaf4ed5ea..74bce25267 100644 --- a/network/netplay/netplay_handshake.c +++ b/network/netplay/netplay_handshake.c @@ -760,6 +760,7 @@ bool netplay_handshake_pre_password(netplay_t *netplay, ssize_t recvd; char msg[512]; bool correct = false; + size_t password_size; settings_t *settings = config_get_ptr(); msg[0] = '\0'; @@ -786,13 +787,14 @@ bool netplay_handshake_pre_password(netplay_t *netplay, /* Calculate the correct password hash(es) and compare */ correct = false; snprintf(password, sizeof(password), "%08X", connection->salt); + password_size = strlen(password); if (settings->paths.netplay_password[0]) { strlcpy(password + 8, settings->paths.netplay_password, sizeof(password)-8); - sha256_hash(hash, (uint8_t *) password, strlen(password)); + sha256_hash(hash, (uint8_t *) password, password_size); if (!memcmp(password_buf.password, hash, NETPLAY_PASS_HASH_LEN)) { @@ -805,7 +807,7 @@ bool netplay_handshake_pre_password(netplay_t *netplay, strlcpy(password + 8, settings->paths.netplay_spectate_password, sizeof(password)-8); - sha256_hash(hash, (uint8_t *) password, strlen(password)); + sha256_hash(hash, (uint8_t *) password, password_size); if (!memcmp(password_buf.password, hash, NETPLAY_PASS_HASH_LEN)) correct = true; diff --git a/tasks/task_image.c b/tasks/task_image.c index 20168ba55d..6ebbe25b65 100644 --- a/tasks/task_image.c +++ b/tasks/task_image.c @@ -135,9 +135,8 @@ static int task_image_iterate_process_transfer(struct nbio_image_handle *image) for (i = 0; i < image->processing_pos_increment; i++) { - retval = task_image_process(image, - &width, &height); - if (retval != IMAGE_PROCESS_NEXT) + if ((retval = task_image_process(image, + &width, &height) != IMAGE_PROCESS_NEXT)) break; }