From de6f113d122bb91447343b1f6fd4b51a0fc6e07c Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Sat, 4 Aug 2018 14:31:45 +1000 Subject: [PATCH] Change parameters of apply_xor() from void * to char * Arithmetic on void * pointers is undefined, according to Section 6.5.6 Paragraph 2, Section 6.2.5 Paragraph 1 and Section 6.2.5 Paragraph 19 of the ISO/IEC 9899:1999 C99 standard: the void type is incomplete and thus its size cannot be determined. GCC allows pointer arithmetic on void * as an extension (and only warns if "-Wpointer-arith" is given); the Oracle Developer Studio C compiler issues a warning by default. --- src/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.c b/src/utils.c index 32a2ed6..1a2be48 100644 --- a/src/utils.c +++ b/src/utils.c @@ -206,7 +206,7 @@ static bool add_currency_symbol = false; // Do we need to add "$"? apply_xor(apply_xor(buffer)) == buffer. It is used by both scramble() and unscramble(). */ -static void apply_xor (void *restrict dest, const void *restrict src, +static void apply_xor (char *restrict dest, const char *restrict src, size_t n, unsigned int *restrict key); @@ -760,7 +760,7 @@ char *unscramble (char *restrict dest, const char *restrict src, /***********************************************************************/ // apply_xor: Scramble a buffer using xor_table -void apply_xor (void *restrict dest, const void *restrict src, +void apply_xor (char *restrict dest, const char *restrict src, size_t n, unsigned int *restrict key) { assert(dest != NULL);