[svn] GnuPG - r5300 - branches/STABLE-BRANCH-1-4/g10
svn author dshaw
cvs at cvs.gnupg.org
Fri Mar 26 17:57:10 CET 2010
Author: dshaw
Date: 2010-03-26 17:57:09 +0100 (Fri, 26 Mar 2010)
New Revision: 5300
Modified:
branches/STABLE-BRANCH-1-4/g10/ChangeLog
branches/STABLE-BRANCH-1-4/g10/plaintext.c
Log:
* plaintext.c (handle_plaintext): Make sure that the stdout flush
succeeded, so we can't lose data when using gpg in a pipeline. Fixes
bug #1207.
Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2010-03-24 12:15:30 UTC (rev 5299)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2010-03-26 16:57:09 UTC (rev 5300)
@@ -1,3 +1,9 @@
+2010-03-26 David Shaw <dshaw at jabberwocky.com>
+
+ * plaintext.c (handle_plaintext): Make sure that the stdout flush
+ succeeded, so we can't lose data when using gpg in a pipeline.
+ Fixes bug #1207.
+
2010-02-17 Werner Koch <wk at g10code.com>
* keygen.c (ask_user_id): Avoid infinite loop in case of invalid
@@ -13615,7 +13621,7 @@
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
Modified: branches/STABLE-BRANCH-1-4/g10/plaintext.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/plaintext.c 2010-03-24 12:15:30 UTC (rev 5299)
+++ branches/STABLE-BRANCH-1-4/g10/plaintext.c 2010-03-26 16:57:09 UTC (rev 5300)
@@ -1,6 +1,6 @@
/* plaintext.c - process plaintext packets
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- * 2006 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ * 2007, 2010 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -392,7 +392,15 @@
/* Make sure that stdout gets flushed after the plaintext has
been handled. This is for extra security as we do a
flush anyway before checking the signature. */
- fflush (stdout);
+ if(fflush(stdout))
+ {
+ /* We check whether this fflush succeeded since fp might have
+ been stdout piping to a file. The fflush could fail if the
+ file cannot be written (disk full, etc). See bug 1207 for
+ more. */
+ log_error("Error flushing plaintext: %s\n",strerror(errno));
+ rc=G10ERR_WRITE_FILE;
+ }
if( fp && fp != stdout )
fclose(fp);
More information about the Gnupg-commits
mailing list