From e3fdcfa45cfec2f38fe27bacd5470a4bf8c77bc1 Mon Sep 17 00:00:00 2001 From: nia Date: Tue, 23 Jun 2020 21:03:01 +0100 Subject: [PATCH] entropy: Avoid arithmetic on void pointer Signed-off-by: nia --- library/entropy_poll.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/entropy_poll.c b/library/entropy_poll.c index 69d06af48..aaff26f48 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -131,6 +131,7 @@ static int getrandom_wrapper( void *buf, size_t buflen, unsigned int flags ) static int sysctl_arnd_wrapper( void *buf, size_t buflen ) { + unsigned char *output = buf; int name[2]; size_t len; @@ -140,10 +141,10 @@ static int sysctl_arnd_wrapper( void *buf, size_t buflen ) while( buflen > 0 ) { len = buflen > 256 ? 256 : buflen; - if( sysctl(name, 2, buf, &len, NULL, 0) == -1 ) + if( sysctl(name, 2, output, &len, NULL, 0) == -1 ) return( -1 ); buflen -= len; - buf += len; + output += len; } return( 0 ); }