From: Alexander Bluhm Date: Mon, 21 Aug 2017 17:33:08 +0000 (+0200) Subject: Do not cast arguments of memcpy(3). X-Git-Tag: R_2_2_5~40^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=793c0669534b2be58197abaf7f244d87b5faac14;p=libexpat Do not cast arguments of memcpy(3). With an explicit cast, the C compiler does not check whether the function's arguments are compatible and will just convert anything. So removing the cast makes the code safer as the compiler will complain in more cases. The implicit cast does the correct thing. --- diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c index 007aed06..82e7acf3 100644 --- a/expat/lib/xmltok.c +++ b/expat/lib/xmltok.c @@ -412,7 +412,7 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc), } const ptrdiff_t bytesToCopy = fromLim - *fromP; - memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy); + memcpy(*toP, *fromP, bytesToCopy); *fromP += bytesToCopy; *toP += bytesToCopy;