mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-19 09:02:22 +02:00
* 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.
This commit is contained in:
parent
40b9d5648d
commit
9d49768999
@ -1,3 +1,9 @@
|
|||||||
|
2005-11-13 David Shaw <dshaw@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@jabberwocky.com>
|
2005-11-11 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* trustdb.h, trustdb.c (clean_key): New function to handle key
|
* trustdb.h, trustdb.c (clean_key): New function to handle key
|
||||||
|
22
g10/armor.c
22
g10/armor.c
@ -339,16 +339,30 @@ parse_header_line( armor_filter_context_t *afx, byte *line, unsigned int len )
|
|||||||
afx->buffer_pos = len2; /* (it is not the fine way to do it here) */
|
afx->buffer_pos = len2; /* (it is not the fine way to do it here) */
|
||||||
return 0; /* WS only: same as empty line */
|
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, ':');
|
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: "));
|
log_error(_("invalid armor header: "));
|
||||||
print_string( stderr, line, len, 0 );
|
print_string( stderr, line, len, 0 );
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Chop off the whitespace we detected before */
|
||||||
|
len=len2;
|
||||||
|
line[len2]='\0';
|
||||||
|
|
||||||
if( opt.verbose ) {
|
if( opt.verbose ) {
|
||||||
log_info(_("armor header: "));
|
log_info(_("armor header: "));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user