mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
Add mimedb infinite loop bug fix from James Reeves
darcs-hash:20090201133734-ac50b-96fb4735af616094ea57ba02266188f8a7038a0c.gz
This commit is contained in:
parent
36c3bd4e8d
commit
c6427c5a47
1 changed files with 4 additions and 2 deletions
6
mimedb.c
6
mimedb.c
|
@ -470,7 +470,7 @@ static char *get_description( const char *mimetype )
|
|||
int fd;
|
||||
struct stat st;
|
||||
char *contents;
|
||||
char *start=0, *stop=0;
|
||||
char *start=0, *stop=0, *best_start=0;
|
||||
|
||||
if( !start_re )
|
||||
{
|
||||
|
@ -583,6 +583,7 @@ static char *get_description( const char *mimetype )
|
|||
while( !regexec(start_re, start, 1, match, 0) )
|
||||
{
|
||||
int new_w = match[0].rm_eo - match[0].rm_so;
|
||||
start += match[0].rm_eo;
|
||||
|
||||
if( new_w > w )
|
||||
{
|
||||
|
@ -591,12 +592,13 @@ static char *get_description( const char *mimetype )
|
|||
match, so we use the new match
|
||||
*/
|
||||
w=new_w;
|
||||
start += match[0].rm_eo;
|
||||
best_start = start;
|
||||
}
|
||||
}
|
||||
|
||||
if( w != -1 )
|
||||
{
|
||||
start = best_start;
|
||||
if( !regexec(stop_re, start, 1, match, 0) )
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue