Sanity check PVK file fields.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 3 Mar 2016 23:37:36 +0000 (23:37 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 4 Mar 2016 01:25:58 +0000 (01:25 +0000)
commitdf14e5023743bde0ed2860817729cee61fab3662
tree4887a9627270aab847bd21000dc541d1848bb0f8
parentdd8518214f97041411ad2af93fd3add4f0886b64
Sanity check PVK file fields.

PVK files with abnormally large length or salt fields can cause an
integer overflow which can result in an OOB read and heap corruption.
However this is an rarely used format and private key files do not
normally come from untrusted sources the security implications not
significant.

Fix by limiting PVK length field to 100K and salt to 10K: these should be
more than enough to cover any files encountered in practice.

Issue reported by Guido Vranken.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 5f57abe2b150139b8b057313d52b1fe8f126c952)
crypto/pem/pvkfmt.c