Commit b3c26d99 authored by Rafaël Carré's avatar Rafaël Carré

update: fix hashing of text files with empty lines

the current status file for 1.1.9 is one of these
parent d420d017
...@@ -730,15 +730,18 @@ uint8_t *hash_sha1_from_text( const char *psz_string, ...@@ -730,15 +730,18 @@ uint8_t *hash_sha1_from_text( const char *psz_string,
while( *psz_string ) while( *psz_string )
{ {
size_t i_len = strcspn( psz_string, "\r\n" ); size_t i_len = strcspn( psz_string, "\r\n" );
if( !i_len )
break;
gcry_md_write( hd, psz_string, i_len ); if( i_len )
{
gcry_md_write( hd, psz_string, i_len );
psz_string += i_len;
}
gcry_md_putc( hd, '\r' ); gcry_md_putc( hd, '\r' );
gcry_md_putc( hd, '\n' ); gcry_md_putc( hd, '\n' );
psz_string += i_len; if( *psz_string == '\r' )
while( *psz_string == '\r' || *psz_string == '\n' ) psz_string++;
if( *psz_string == '\n' )
psz_string++; psz_string++;
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment