[svn] GnuPG - r3935 - trunk/g10
svn author dshaw
cvs at cvs.gnupg.org
Sun Nov 13 22:48:53 CET 2005
Author: dshaw
Date: 2005-11-13 22:48:52 +0100 (Sun, 13 Nov 2005)
New Revision: 3935
Modified:
trunk/g10/ChangeLog
trunk/g10/armor.c
Log:
* armor.c (parse_header_line): A fussy bit of 2440: header lines are
delimited with a colon-space pair. Therefore a line such as "Comment:
" is actually legal, albeit not particularly useful.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2005-11-13 19:07:06 UTC (rev 3934)
+++ trunk/g10/ChangeLog 2005-11-13 21:48:52 UTC (rev 3935)
@@ -1,3 +1,9 @@
+2005-11-13 David Shaw <dshaw at jabberwocky.com>
+
+ * armor.c (parse_header_line): A fussy bit of 2440: header lines
+ are delimited with a colon-space pair. Therefore a line such as
+ "Comment: " is actually legal, albeit not particularly useful.
+
2005-11-11 David Shaw <dshaw at jabberwocky.com>
* trustdb.h, trustdb.c (clean_key): New function to handle key
Modified: trunk/g10/armor.c
===================================================================
--- trunk/g10/armor.c 2005-11-13 19:07:06 UTC (rev 3934)
+++ trunk/g10/armor.c 2005-11-13 21:48:52 UTC (rev 3935)
@@ -339,17 +339,31 @@
afx->buffer_pos = len2; /* (it is not the fine way to do it here) */
return 0; /* WS only: same as empty line */
}
- len = len2;
- line[len2] = 0;
+ /*
+ This is fussy. The spec says that a header line is delimited
+ with a colon-space pair. This means that a line such as
+ "Comment: " (with nothing else) is actually legal as an empty
+ string comment. However, email and cut-and-paste being what it
+ is, that trailing space may go away. Therefore, we accept empty
+ headers delimited with only a colon. --rfc2440, as always,
+ makes this strict and enforces the colon-space pair. -dms
+ */
+
p = strchr( line, ':');
- if( !p || !p[1] ) {
+ if( !p || (RFC2440 && p[1]!=' ')
+ || (!RFC2440 && p[1]!=' ' && p[1]!='\n' && p[1]!='\r'))
+ {
log_error(_("invalid armor header: "));
print_string( stderr, line, len, 0 );
putc('\n', stderr);
return -1;
- }
+ }
+ /* Chop off the whitespace we detected before */
+ len=len2;
+ line[len2]='\0';
+
if( opt.verbose ) {
log_info(_("armor header: "));
print_string( stderr, line, len, 0 );
More information about the Gnupg-commits
mailing list