diff --git a/ChangeLog b/ChangeLog index bf5e89959..bb280f051 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jun 8 12:47:25 CEST 2010 (tk) +---------------------------------- + * shared/cdiff.c: fix handling of massive XCHGs (bb#2017) + Fri Jun 4 18:04:37 CEST 2010 (tk) ---------------------------------- * libclamav/cvd.c: load daily.ign[2] files from CVDs (bb#2061) diff --git a/shared/cdiff.c b/shared/cdiff.c index 56a380dcc..68011a302 100644 --- a/shared/cdiff.c +++ b/shared/cdiff.c @@ -64,7 +64,7 @@ struct cdiff_ctx { char *open_db; struct cdiff_node *add_start, *add_last; struct cdiff_node *del_start; - struct cdiff_node *xchg_start; + struct cdiff_node *xchg_start, *xchg_last; }; struct cdiff_cmd { @@ -324,32 +324,12 @@ static int cdiff_cmd_xchg(const char *cmdstr, struct cdiff_ctx *ctx, char *lbuf, new->str2 = arg2; new->lineno = lineno; - if(!ctx->xchg_start) { - + if(!ctx->xchg_start) ctx->xchg_start = new; + else + ctx->xchg_last->next = new; - } else { - - if(lineno < ctx->xchg_start->lineno) { - new->next = ctx->xchg_start; - ctx->xchg_start = new; - - } else { - pt = ctx->xchg_start; - - while(pt) { - last = pt; - if((pt->lineno < lineno) && (!pt->next || lineno < pt->next->lineno)) - break; - - pt = pt->next; - } - - new->next = last->next; - last->next = new; - } - } - + ctx->xchg_last = new; return 0; }