Fix srp app missing NULL termination with password callback
authorDiego Santa Cruz <Diego.SantaCruz@spinetix.com>
Tue, 16 May 2017 14:05:19 +0000 (16:05 +0200)
committerAndy Polyakov <appro@openssl.org>
Thu, 1 Jun 2017 20:22:24 +0000 (22:22 +0200)
The password_callback() function does not necessarily NULL terminate
the password buffer, the caller must use the returned length but the
srp app uses this function as if it was doing NULL termination.

This made the -passin and -passout options of "openssl srp"
fail inexpicably and randomly or even crash.

Fixed by enlarging the buffer by one, so that the maximum password length
remains unchanged, and adding NULL termination upon return.

[Rearrange code for coding style compliance in process.]

This backport of 0e83981d61fc435f42d4bb4d774272b69556b7bc.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3579)


No differences found