summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2011-03-26 01:01:17 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-03-26 01:01:17 +0100
commite8df5a70b7ee05e7f835348350e06533732d05aa (patch)
tree99fa2eed0ec14049ffd13242701f2ed64d186576
parentc09e61a8941dd002cfa75fb449dbd069d2f866b1 (diff)
downloadgnutls-e8df5a70b7ee05e7f835348350e06533732d05aa.tar.gz
Corrected access to freed memory location. Reported by Vitaly Kruglikov.
-rw-r--r--lib/opencdk/stream.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/opencdk/stream.c b/lib/opencdk/stream.c
index 29bea09bac..a9e0af3a4e 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;
}
@@ -822,6 +823,7 @@ stream_filter_write (cdk_stream_t s)
{
_gnutls_read_log ("filter [close]: fd=%d\n", fileno (f->tmp));
fclose (f->tmp);
+ f->tmp = NULL;
break;
}
}
@@ -960,7 +962,7 @@ cdk_stream_read (cdk_stream_t s, void *buf, size_t buflen)
if (rc)
{
s->error = rc;
- if (feof (s->fp))
+ if (s->fp && feof (s->fp))
s->flags.eof = 1;
gnutls_assert ();
return EOF;