Make sure the grcy_get_config string is always null-terminated.

Authored by jukivili on Jan 31 2021, 3:59 PM.

Description

Make sure the grcy_get_config string is always null-terminated.

* src/global.c (_gcry_get_config): Append null-terminator to output.

Config string was not being explicitly null-terminated which resulted
garbage output from tests/version with ASAN enabled builds.

  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Auditors
werner
Committed
wernerFeb 4 2021, 12:49 PM
Parents
rC370e44127287: Add handling for -Og with O-flag munging
Branches
Unknown
Tags
Unknown
jukivili added inline comments.
/src/global.c
423

Hm.. Actually this needs to closed with if (!what) {...}.

Otherwise tests/version will print: version: gcry_get_config("no-such-item") returned something.

@werner

werner added inline comments.Sun, Feb 14, 6:48 PM
/src/global.c
423

Right. I was already wondering why you did this in master. I forgot about that test and didn't run a make check.

All concerns with this commit have now been addressed.Sun, Feb 14, 7:00 PM