diff options
author | Werner Koch <wk@gnupg.org> | 2021-02-14 18:54:40 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2021-02-14 18:54:40 +0100 |
commit | a5799f1618aaf1bbb52e7e121275228dd4a3ac8b (patch) | |
tree | 35ab38f4ba27b343b1f6ff6ef7b080c1f4058ff3 | |
parent | 3f42f727a0699f7274a99ea39def7f9b4c3b0c1e (diff) | |
download | libgcrypt-a5799f1618aaf1bbb52e7e121275228dd4a3ac8b.tar.gz |
Fix previous commit
* src/global.c (_gcry_get_config): Append the Nul only in the !what
case.
--
Fixes-commit: 3f42f727a0699f7274a99ea39def7f9b4c3b0c1e
Actually this was my fault - I stripped off the test which Jussi did in
his original fix on master. And did not run make check.
Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r-- | src/global.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/global.c b/src/global.c index 7d634095..95daedac 100644 --- a/src/global.c +++ b/src/global.c @@ -419,8 +419,13 @@ _gcry_get_config (int mode, const char *what) print_config (what, fp); - /* Make sure the output is null terminated. */ - gpgrt_fwrite ("", 1, 1, fp); + /* Make sure the output is null terminated if no specific item was + * requested. This is needed because tests/version.c expects that + * the function fails with the !data case below. For the specific + * test an extra nul is not required because we always have a LF + * which is then replaced right at the end of this function. */ + if (!what) + gpgrt_fwrite ("", 1, 1, fp); if (gpgrt_ferror (fp)) { |