diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-10 23:58:47 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-10 23:58:47 +0000 |
commit | 75ec2c8398afde059e3a2403ca8907229d3720de (patch) | |
tree | 7b579f82171b6e7b533dffb95c31493370479c05 | |
parent | a0bd4c247472c1997afbe8683ef460dadbb16b46 (diff) |
Fixed an "off-by -1" bug in msn_findheader() that could probably be triggered
by incoming messages without headers.
-rw-r--r-- | protocols/msn/msn_util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index 6b12217b..668a8b8a 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -170,9 +170,9 @@ char *msn_findheader( char *text, char *header, int len ) while( i < len && ( text[i] == '\r' || text[i] == '\n' ) ) i ++; /* End of headers? */ - if( strncmp( text + i - 2, "\n\n", 2 ) == 0 || - strncmp( text + i - 4, "\r\n\r\n", 4 ) == 0 || - strncmp( text + i - 2, "\r\r", 2 ) == 0 ) + if( ( i >= 4 && strncmp( text + i - 4, "\r\n\r\n", 4 ) == 0 ) || + ( i >= 2 && ( strncmp( text + i - 2, "\n\n", 2 ) == 0 || + strncmp( text + i - 2, "\r\r", 2 ) == 0 ) ) ) { break; } |