...
|
...
|
@@ -399,7 +399,7 @@ cl_error_t cli_bcomp_scanbuf(fmap_t *map, const char **virname, struct cli_ac_re
|
399
|
399
|
if(res) {
|
400
|
400
|
newres = (struct cli_ac_result *)cli_calloc(1, sizeof(struct cli_ac_result));
|
401
|
401
|
if(!newres) {
|
402
|
|
- cli_errmsg("cli_bcomp_scanbuff: Can't allocate memory for new result\n");
|
|
402
|
+ cli_errmsg("cli_bcomp_scanbuf: Can't allocate memory for new result\n");
|
403
|
403
|
ret = CL_EMEM;
|
404
|
404
|
break;
|
405
|
405
|
}
|
...
|
...
|
@@ -460,7 +460,7 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
460
|
460
|
const unsigned char* end_buf = NULL;
|
461
|
461
|
|
462
|
462
|
if (!map || !bm) {
|
463
|
|
- bcm_dbgmsg("bcmp_compare_check: a param is null\n");
|
|
463
|
+ bcm_dbgmsg("cli_bcomp_compare_check: a param is null\n");
|
464
|
464
|
return CL_ENULLARG;
|
465
|
465
|
}
|
466
|
466
|
|
...
|
...
|
@@ -471,12 +471,12 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
471
|
471
|
/* ensure we won't run off the end of the file buffer */
|
472
|
472
|
if (bm->offset > 0) {
|
473
|
473
|
if (!((offset + bm->offset + byte_len <= length))) {
|
474
|
|
- bcm_dbgmsg("bcmp_compare_check: %u bytes requested at offset %zu would go past file buffer of %u\n", byte_len, (offset + bm->offset), length);
|
|
474
|
+ bcm_dbgmsg("cli_bcomp_compare_check: %u bytes requested at offset %zu would go past file buffer of %u\n", byte_len, (offset + bm->offset), length);
|
475
|
475
|
return CL_CLEAN;
|
476
|
476
|
}
|
477
|
477
|
} else {
|
478
|
478
|
if (!(offset + bm->offset > 0)) {
|
479
|
|
- bcm_dbgmsg("bcmp_compare_check: negative offset would underflow buffer\n");
|
|
479
|
+ bcm_dbgmsg("cli_bcomp_compare_check: negative offset would underflow buffer\n");
|
480
|
480
|
return CL_CLEAN;
|
481
|
481
|
}
|
482
|
482
|
}
|
...
|
...
|
@@ -485,10 +485,10 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
485
|
485
|
offset += bm->offset;
|
486
|
486
|
buffer = fmap_need_off_once(map, offset, byte_len);
|
487
|
487
|
if (!buffer) {
|
488
|
|
- bcm_dbgmsg("bcmp_compare_check: could not extract bytes from buffer offset\n");
|
|
488
|
+ bcm_dbgmsg("cli_bcomp_compare_check: could not extract bytes from buffer offset\n");
|
489
|
489
|
return CL_EMEM;
|
490
|
490
|
}
|
491
|
|
- bcm_dbgmsg("bcmp_compare_check: literal extracted bytes before comparison %s\n", buffer);
|
|
491
|
+ bcm_dbgmsg("cli_bcomp_compare_check: literal extracted bytes before comparison %s\n", buffer);
|
492
|
492
|
|
493
|
493
|
/* grab the first byte to handle byte length options to convert the string appropriately */
|
494
|
494
|
switch((opt & 0x00FF)) {
|
...
|
...
|
@@ -498,14 +498,14 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
498
|
498
|
value = cli_strntol((char*) buffer, byte_len, (char**) &end_buf, 16);
|
499
|
499
|
if ((((value == LONG_MAX) || (value == LONG_MIN)) && errno == ERANGE) || NULL == end_buf) {
|
500
|
500
|
|
501
|
|
- bcm_dbgmsg("bcmp_compare_check: little endian hex conversion unsuccessful\n");
|
|
501
|
+ bcm_dbgmsg("cli_bcomp_compare_check: little endian hex conversion unsuccessful\n");
|
502
|
502
|
return CL_CLEAN;
|
503
|
503
|
}
|
504
|
504
|
/*hle*/
|
505
|
505
|
if (opt & CLI_BCOMP_EXACT) {
|
506
|
506
|
if (buffer+byte_len != end_buf) {
|
507
|
507
|
|
508
|
|
- bcm_dbgmsg("bcmp_compare_check: couldn't extract the exact number of requested bytes\n");
|
|
508
|
+ bcm_dbgmsg("cli_bcomp_compare_check: couldn't extract the exact number of requested bytes\n");
|
509
|
509
|
return CL_CLEAN;
|
510
|
510
|
}
|
511
|
511
|
}
|
...
|
...
|
@@ -518,14 +518,14 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
518
|
518
|
value = cli_strntol((char*) buffer, byte_len, (char**) &end_buf, 16);
|
519
|
519
|
if ((((value == LONG_MAX) || (value == LONG_MIN)) && errno == ERANGE) || NULL == end_buf) {
|
520
|
520
|
|
521
|
|
- bcm_dbgmsg("bcmp_compare_check: big endian hex conversion unsuccessful\n");
|
|
521
|
+ bcm_dbgmsg("cli_bcomp_compare_check: big endian hex conversion unsuccessful\n");
|
522
|
522
|
return CL_CLEAN;
|
523
|
523
|
}
|
524
|
524
|
/*hbe*/
|
525
|
525
|
if (opt & CLI_BCOMP_EXACT) {
|
526
|
526
|
if (buffer+byte_len != end_buf) {
|
527
|
527
|
|
528
|
|
- bcm_dbgmsg("bcmp_compare_check: couldn't extract the exact number of requested bytes\n");
|
|
528
|
+ bcm_dbgmsg("cli_bcomp_compare_check: couldn't extract the exact number of requested bytes\n");
|
529
|
529
|
return CL_CLEAN;
|
530
|
530
|
}
|
531
|
531
|
}
|
...
|
...
|
@@ -538,14 +538,14 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
538
|
538
|
value = cli_strntol((char*) buffer, byte_len, (char**) &end_buf, 10);
|
539
|
539
|
if ((((value == LONG_MAX) || (value == LONG_MIN)) && errno == ERANGE) || NULL == end_buf) {
|
540
|
540
|
|
541
|
|
- bcm_dbgmsg("bcmp_compare_check: little endian decimal conversion unsuccessful\n");
|
|
541
|
+ bcm_dbgmsg("cli_bcomp_compare_check: little endian decimal conversion unsuccessful\n");
|
542
|
542
|
return CL_CLEAN;
|
543
|
543
|
}
|
544
|
544
|
/*dle*/
|
545
|
545
|
if (opt & CLI_BCOMP_EXACT) {
|
546
|
546
|
if (buffer+byte_len != end_buf) {
|
547
|
547
|
|
548
|
|
- bcm_dbgmsg("bcmp_compare_check: couldn't extract the exact number of requested bytes\n");
|
|
548
|
+ bcm_dbgmsg("cli_bcomp_compare_check: couldn't extract the exact number of requested bytes\n");
|
549
|
549
|
return CL_CLEAN;
|
550
|
550
|
}
|
551
|
551
|
}
|
...
|
...
|
@@ -558,14 +558,14 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
558
|
558
|
value = cli_strntol((char*) buffer, byte_len, (char**) &end_buf, 10);
|
559
|
559
|
if ((((value == LONG_MAX) || (value == LONG_MIN)) && errno == ERANGE) || NULL == end_buf) {
|
560
|
560
|
|
561
|
|
- bcm_dbgmsg("bcmp_compare_check: big endian decimal conversion unsuccessful\n");
|
|
561
|
+ bcm_dbgmsg("cli_bcomp_compare_check: big endian decimal conversion unsuccessful\n");
|
562
|
562
|
return CL_CLEAN;
|
563
|
563
|
}
|
564
|
564
|
/*dbe*/
|
565
|
565
|
if (opt & CLI_BCOMP_EXACT) {
|
566
|
566
|
if (buffer+byte_len != end_buf) {
|
567
|
567
|
|
568
|
|
- bcm_dbgmsg("bcmp_compare_check: couldn't extract the exact number of requested bytes\n");
|
|
568
|
+ bcm_dbgmsg("cli_bcomp_compare_check: couldn't extract the exact number of requested bytes\n");
|
569
|
569
|
return CL_CLEAN;
|
570
|
570
|
}
|
571
|
571
|
}
|
...
|
...
|
@@ -582,7 +582,7 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
582
|
582
|
case 8: value = le64_to_host( *(int64_t*) buffer); break;
|
583
|
583
|
|
584
|
584
|
default:
|
585
|
|
- bcm_dbgmsg("bcmp_compare_check: invalid byte size for binary integer field (%u)\n", byte_len);
|
|
585
|
+ bcm_dbgmsg("cli_bcomp_compare_check: invalid byte size for binary integer field (%u)\n", byte_len);
|
586
|
586
|
return CL_EARG;
|
587
|
587
|
}
|
588
|
588
|
break;
|
...
|
...
|
@@ -596,7 +596,7 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
596
|
596
|
case 8: value = be64_to_host( *(int64_t*) buffer); break;
|
597
|
597
|
|
598
|
598
|
default:
|
599
|
|
- bcm_dbgmsg("bcmp_compare_check: invalid byte size for binary integer field (%u)\n", byte_len);
|
|
599
|
+ bcm_dbgmsg("cli_bcomp_compare_check: invalid byte size for binary integer field (%u)\n", byte_len);
|
600
|
600
|
return CL_EARG;
|
601
|
601
|
}
|
602
|
602
|
break;
|
...
|
...
|
@@ -609,32 +609,32 @@ cl_error_t cli_bcomp_compare_check(fmap_t *map, int offset, struct cli_bcomp_met
|
609
|
609
|
|
610
|
610
|
case '>':
|
611
|
611
|
if (value > bm->comp_value) {
|
612
|
|
- bcm_dbgmsg("bcmp_compare_check: extracted value (%ld) greater than comparison value (%ld)\n", value, bm->comp_value);
|
|
612
|
+ bcm_dbgmsg("cli_bcomp_compare_check: extracted value (%ld) greater than comparison value (%ld)\n", value, bm->comp_value);
|
613
|
613
|
return CL_VIRUS;
|
614
|
614
|
}
|
615
|
615
|
break;
|
616
|
616
|
|
617
|
617
|
case '<':
|
618
|
618
|
if (value < bm->comp_value) {
|
619
|
|
- bcm_dbgmsg("bcmp_compare_check: extracted value (%ld) less than comparison value (%ld)\n", value, bm->comp_value);
|
|
619
|
+ bcm_dbgmsg("cli_bcomp_compare_check: extracted value (%ld) less than comparison value (%ld)\n", value, bm->comp_value);
|
620
|
620
|
return CL_VIRUS;
|
621
|
621
|
}
|
622
|
622
|
break;
|
623
|
623
|
|
624
|
624
|
case '=':
|
625
|
625
|
if (value == bm->comp_value) {
|
626
|
|
- bcm_dbgmsg("bcmp_compare_check: extracted value (%ld) equal to comparison value (%ld)\n", value, bm->comp_value);
|
|
626
|
+ bcm_dbgmsg("cli_bcomp_compare_check: extracted value (%ld) equal to comparison value (%ld)\n", value, bm->comp_value);
|
627
|
627
|
return CL_VIRUS;
|
628
|
628
|
}
|
629
|
629
|
break;
|
630
|
630
|
|
631
|
631
|
default:
|
632
|
|
- bcm_dbgmsg("bcmp_compare_check: comparison symbol (%c) invalid\n", bm->comp_symbol);
|
|
632
|
+ bcm_dbgmsg("cli_bcomp_compare_check: comparison symbol (%c) invalid\n", bm->comp_symbol);
|
633
|
633
|
return CL_ENULLARG;
|
634
|
634
|
}
|
635
|
635
|
|
636
|
636
|
/* comparison was not successful */
|
637
|
|
- bcm_dbgmsg("bcmp_compare_check: extracted value was not %c %ld\n", bm->comp_symbol, bm->comp_value);
|
|
637
|
+ bcm_dbgmsg("cli_bcomp_compare_check: extracted value was not %c %ld\n", bm->comp_symbol, bm->comp_value);
|
638
|
638
|
return CL_CLEAN;
|
639
|
639
|
}
|
640
|
640
|
|