From 217a29c844e3a12e71ff89c77d16fef6ef2045ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 3 Jan 2014 11:59:09 +0100 Subject: [PATCH] Fix bug in rnd_pseudo_rnd() test helper function Only the first 4 bytes of the output were set, the rest was untouched. --- tests/suites/helpers.function | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index b3349546d..4c095d3c9 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -206,7 +206,7 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len ) { rnd_pseudo_info *info = (rnd_pseudo_info *) rng_state; uint32_t i, *k, sum, delta=0x9E3779B9; - unsigned char result[4]; + unsigned char result[4], *out = output; if( rng_state == NULL ) return( rnd_std_rand( NULL, output, len ) ); @@ -226,8 +226,9 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len ) } PUT_UINT32_BE( info->v0, result, 0 ); - memcpy( output, result, use_len ); + memcpy( out, result, use_len ); len -= use_len; + out += 4; } return( 0 );