diff options
author | Werner Koch <[email protected]> | 2020-09-04 09:24:34 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-09-04 09:24:34 +0000 |
commit | 6ce8fdc4b2a05bb2c1cf2aa9faa76f1c7a4fdb28 (patch) | |
tree | b73613fb2ab5c60c5a27409d3c3a6b8c34eccd5f | |
parent | Post release updates (diff) | |
download | gnupg-6ce8fdc4b2a05bb2c1cf2aa9faa76f1c7a4fdb28.tar.gz gnupg-6ce8fdc4b2a05bb2c1cf2aa9faa76f1c7a4fdb28.zip |
gpg: Initialize a parameter to silence valgrind.
* g10/keygen.c (read_parameter_file): Initialize nline.
* g10/textfilter.c (copy_clearsig_text): Initialize bufsize.
--
In iobuf_read_line the parameter to pass and return the current buffer
length is controlled by the buffer parameter. Thus there should be no
problem because the assert call check s buffer first. For yet unknown
reasons when using the standard GNU libc assert valgrind complains
about an uninitialized variable. That does not happen with our
log_assert. Tested with gcc 8.3.0 and valgrind 3.14.0.
-rw-r--r-- | g10/keygen.c | 1 | ||||
-rw-r--r-- | g10/textfilter.c | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/g10/keygen.c b/g10/keygen.c index 471f52a5a..bbcd1e18e 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -4039,6 +4039,7 @@ read_parameter_file (ctrl_t ctrl, const char *fname ) para = NULL; maxlen = 1024; line = NULL; + nline = 0; while ( iobuf_read_line (fp, &line, &nline, &maxlen) ) { char *keyword, *value; diff --git a/g10/textfilter.c b/g10/textfilter.c index 96666cf17..3e68900bb 100644 --- a/g10/textfilter.c +++ b/g10/textfilter.c @@ -163,8 +163,8 @@ copy_clearsig_text( IOBUF out, IOBUF inp, gcry_md_hd_t md, int escape_dash, int escape_from) { unsigned int maxlen; - byte *buffer = NULL; /* malloced buffer */ - unsigned int bufsize; /* and size of this buffer */ + byte *buffer = NULL; /* malloced buffer */ + unsigned int bufsize = 0; /* and size of this buffer */ unsigned int n; int truncated = 0; int pending_lf = 0; |