]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Corrected access to freed memory location. Reported by Vitaly Kruglikov.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 26 Mar 2011 00:01:17 +0000 (01:01 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 26 Mar 2011 00:04:53 +0000 (01:04 +0100)
lib/opencdk/stream.c

index 29bea09bac8e47d5edc0049b550bf41e6108faa4..a9e0af3a4ed8ea8e9c295e11ef5c1dbc2e362674 100644 (file)
@@ -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;