diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-03-26 01:01:17 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-03-26 01:12:52 +0100 |
commit | f02d56a76e4ac5a6ebc65e5277250cbe73ba6ca0 (patch) | |
tree | f2be7bdc829ed0b9a629d76b12f1873cafe85f91 | |
parent | 65c8d4d228993dc7c6f36cdb8b11355bf4c7814e (diff) | |
download | gnutls-f02d56a76e4ac5a6ebc65e5277250cbe73ba6ca0.tar.gz |
Corrected access to freed memory location. Reported by Vitaly Kruglikov.
-rw-r--r-- | lib/opencdk/stream.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/opencdk/stream.c b/lib/opencdk/stream.c index 4dfa8f1dbd..0f3660f6d9 100644 --- a/lib/opencdk/stream.c +++ b/lib/opencdk/stream.c @@ -761,6 +761,7 @@ stream_fp_replace (cdk_stream_t s, FILE ** tmp) rc = fclose (s->fp); if (rc) { + s->fp = NULL; gnutls_assert (); return CDK_File_Error; } @@ -819,11 +820,12 @@ stream_filter_write (cdk_stream_t s) if (!rc) rc = cdk_stream_seek (s, 0); if (rc) - { - _cdk_log_debug ("filter [close]: fd=%d\n", fileno (f->tmp)); - fclose (f->tmp); - break; - } + { + _gnutls_read_log ("filter [close]: fd=%d\n", fileno (f->tmp)); + fclose (f->tmp); + f->tmp = NULL; + break; + } } return rc; } @@ -958,13 +960,13 @@ cdk_stream_read (cdk_stream_t s, void *buf, size_t buflen) { rc = stream_filter_read (s); if (rc) - { - s->error = rc; - if (feof (s->fp)) - s->flags.eof = 1; - gnutls_assert (); - return EOF; - } + { + s->error = rc; + if (s->fp && feof (s->fp)) + s->flags.eof = 1; + gnutls_assert (); + return EOF; + } s->flags.filtrated = 1; } |