From 28be9537a632625deaa7d71979ebf725b1b9bbc2 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 1 May 2023 20:41:00 +0200 Subject: Return error instead of truncating command buffer if command is too long --- src/libirecovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libirecovery.c b/src/libirecovery.c index fc1e2cf..8ebc9fa 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -2601,7 +2601,7 @@ IRECV_API void irecv_set_debug_level(int level) { static irecv_error_t irecv_send_command_raw(irecv_client_t client, const char* command, uint8_t b_request) { unsigned int length = strlen(command); if (length >= 0x100) { - length = 0xFF; + return IRECV_E_INVALID_INPUT; } if (length > 0) { @@ -2623,7 +2623,7 @@ IRECV_API irecv_error_t irecv_send_command_breq(irecv_client_t client, const cha unsigned int length = strlen(command); if (length >= 0x100) { - length = 0xFF; + return IRECV_E_INVALID_INPUT; } irecv_event_t event; -- cgit v1.1-32-gdbae