From: Nikos Mavrogiannopoulos Date: Sat, 26 Mar 2011 00:01:17 +0000 (+0100) Subject: Corrected access to freed memory location. Reported by Vitaly Kruglikov. X-Git-Tag: gnutls_2_99_0~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d0d34299c2697da3ce87c126a1eb68205ada254;p=thirdparty%2Fgnutls.git Corrected access to freed memory location. Reported by Vitaly Kruglikov. --- 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;