~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to libclamav/matcher-ac.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <unistd.h>
34
34
#endif
35
35
 
 
36
#include <openssl/ssl.h>
 
37
#include <openssl/err.h>
 
38
#include "libclamav/crypto.h"
 
39
 
36
40
#include "clamav.h"
37
41
#include "others.h"
38
42
#include "matcher.h"
311
315
    while((node = bfs_dequeue(&bfs, &bfs_last))) {
312
316
        if(IS_LEAF(node)) {
313
317
            struct cli_ac_node *failtarget = node->fail;
314
 
            while(IS_LEAF(failtarget))
 
318
            while (NULL != failtarget && (IS_LEAF(failtarget) || !IS_FINAL(failtarget)))
315
319
                failtarget = failtarget->fail;
316
 
            node->fail = failtarget;
 
320
            if (NULL != failtarget)
 
321
                node->fail = failtarget;
317
322
            continue;
318
323
        }
319
324
 
915
920
        cli_errmsg("cli_ac_init: data == NULL\n");
916
921
        return CL_ENULLARG;
917
922
    }
 
923
    memset((void *)data, 0, sizeof(struct cli_ac_data));
918
924
 
919
925
    data->reloffsigs = reloffsigs;
920
926
    if(reloffsigs) {
1395
1401
 
1396
1402
                                    cli_dbgmsg("Matched signature for file type %s at %u\n", pt->virname, realoff);
1397
1403
                                    type = pt->type;
1398
 
                                    if(ftoffset && (!*ftoffset || (*ftoffset)->cnt < MAX_EMBEDDED_OBJ || type == CL_TYPE_ZIPSFX) && (type >= CL_TYPE_SFX || ((ftype == CL_TYPE_MSEXE || ftype == CL_TYPE_ZIP || ftype == CL_TYPE_MSOLE2) && type == CL_TYPE_MSEXE)))  {
 
1404
                                    if(ftoffset && (!*ftoffset || (*ftoffset)->cnt < MAX_EMBEDDED_OBJ || type == CL_TYPE_ZIPSFX) && (type == CL_TYPE_MBR || type >= CL_TYPE_SFX || ((ftype == CL_TYPE_MSEXE || ftype == CL_TYPE_ZIP || ftype == CL_TYPE_MSOLE2) && type == CL_TYPE_MSEXE)))  {
1399
1405
 
1400
1406
                                        if(ac_addtype(ftoffset, type, realoff, ctx))
1401
1407
                                            return CL_EMEM;