apps/speed: fix segfault while looking up algorithm name
authorJeff Mahoney <jeffm@suse.com>
Sun, 24 Feb 2019 08:56:28 +0000 (16:56 +0800)
committerPaul Yang <yang.yang@baishancloud.com>
Sun, 24 Feb 2019 08:56:28 +0000 (16:56 +0800)
commit3318493b85a8189f6385d5489f97f0e101471f92
tree153ce9f2bfc7a0b1d9ff77fc562c1f527cb3eb33
parentf499873c2ff5a6da5f1a23c099730f97c822e90c
apps/speed: fix segfault while looking up algorithm name

The backport of master commit 5c6a69f539a (apps/speed: fix possible OOB
access in some EC arrays) as 1.1.0 commit 4e07941373a introduced a
regression.  The ecdh_choices array is iterated using an element count
but is NULL terminated.  This means that running 'openssl speed somealgo'
will result in a segfault when opt_found hits the NULL entry.

Fixes #8243

CLA: trivial

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8244)
apps/speed.c