cmp.c: Avoid dereference with negative index and use memcpy
authorTomas Mraz <tomas@openssl.org>
Wed, 13 Oct 2021 07:00:31 +0000 (09:00 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 25 Oct 2021 13:02:05 +0000 (15:02 +0200)
commite07db550547636881c38a4834cca2f9a8689d60c
treec271df72c7bb2c86a4abe8c846d99030a316e5a5
parent1461059fe97b9abfb1c5414b314790f0bd65e0a0
cmp.c: Avoid dereference with negative index and use memcpy

This prevents a compile-time warning on newer gcc.

Also fix the related warning message.

Fixes #16814

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16821)

(cherry picked from commit 767db672c429aeb98a68b0e310dea15f1b48eb84)
apps/cmp.c