From c58858865b1b706ff2c1699b215d76bf827a78a1 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 24 Nov 2022 20:35:04 +0000 Subject: [PATCH] Fix off-by-one error Signed-off-by: Dave Rodgman --- library/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/common.h b/library/common.h index 943f84c489..c17506416b 100644 --- a/library/common.h +++ b/library/common.h @@ -89,7 +89,7 @@ extern void (*mbedtls_test_hook_test_fail)( const char * test, int line, const c inline void mbedtls_xor( unsigned char *r, unsigned char const *a, unsigned char const *b, size_t n ) { size_t i; - for ( i = 0; ( i + 4 ) < n; i+= 4 ) + for ( i = 0; ( i + 4 ) <= n; i += 4 ) { uint32_t x = mbedtls_get_unaligned_uint32( a + i ) ^ mbedtls_get_unaligned_uint32( b + i ); mbedtls_put_unaligned_uint32( r + i, x );