summaryrefslogtreecommitdiff
path: root/pith/smkeys.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-05-02 20:27:22 -0600
committerEduardo Chappa <chappa@washington.edu>2018-05-02 20:27:22 -0600
commita252c8d3ee63d466c7ec710286d9a299abe8982c (patch)
tree565423baafad7c9be17959d8bc75b0eab6658f9d /pith/smkeys.c
parentc1b6c3ea38d9c61bca1085aaee6f2c153357ccdb (diff)
downloadalpine-a252c8d3ee63d466c7ec710286d9a299abe8982c.tar.xz
* Changes to make Valgrind happy. Work in progress.
Diffstat (limited to 'pith/smkeys.c')
-rw-r--r--pith/smkeys.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pith/smkeys.c b/pith/smkeys.c
index 1889bb96..25144470 100644
--- a/pith/smkeys.c
+++ b/pith/smkeys.c
@@ -637,7 +637,8 @@ smime_get_date(const ASN1_TIME *tm)
char date[MAILTMPLEN];
char buf[MAILTMPLEN];
char *m, *d, *t, *y, *z;
- struct date smd;
+ int len;
+ struct date smd;
struct tm smtm;
(void) BIO_reset(mb);
@@ -645,7 +646,8 @@ smime_get_date(const ASN1_TIME *tm)
return cpystr(_("Invalid"));
(void) BIO_flush(mb);
- BIO_read(mb, iobuf, sizeof(iobuf));
+ len = BIO_read(mb, iobuf, sizeof(iobuf));
+ iobuf[len-1] = '\0';
/* openssl returns the date in the format:
* "MONTH (as name) DAY (as number) TIME(hh:mm:ss) YEAR GMT"
@@ -678,6 +680,7 @@ smime_get_date(const ASN1_TIME *tm)
snprintf(buf, sizeof(buf), "%s/%s/%s", m, d, y + strlen(y) - 2);
buf[sizeof(buf)-1] = '\0';
+ BIO_free(mb);
return cpystr(buf);
}