~ubuntu-branches/ubuntu/maverick/strongswan/maverick

« back to all changes in this revision

Viewing changes to src/charon/encoding/parser.c

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2009-04-01 22:17:52 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090401221752-eozrk0ctabblo94z
* New upstream release, which incorporates the fix. Removed dpatch for it.
  Closes: #521950: CVE-2009-0790: DoS
* New support for EAP RADIUS authentication, enabled for this package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
14
 * for more details.
15
15
 *
16
 
 * $Id: parser.c 4010 2008-05-23 18:23:17Z martin $
 
16
 * $Id: parser.c 4703 2008-11-26 10:54:08Z martin $
17
17
 */
18
18
 
19
19
#include <stdlib.h>
62
62
        parser_t public;
63
63
        
64
64
        /**
65
 
         * Parse a 4-Bit unsigned integer from the current parsing position.
66
 
         * 
67
 
         * @param this                          parser_t object
68
 
         * @param rule_number           number of current rule
69
 
         * @param[out] output_pos       pointer where to write the parsed result
70
 
         * @return                                      
71
 
         *                                                      - SUCCESS or
72
 
         *                                                      - PARSE_ERROR when not successful
73
 
         */
74
 
        status_t (*parse_uint4)  (private_parser_t *this, int rule_number, u_int8_t *output_pos);
75
 
        
76
 
        /**
77
 
         * Parse a 8-Bit unsigned integer from the current parsing position.
78
 
         * 
79
 
         * @param this                          parser_t object
80
 
         * @param rule_number           number of current rule
81
 
         * @param[out] output_pos       pointer where to write the parsed result
82
 
         * @return                                      
83
 
         *                                                      - SUCCESS or
84
 
         *                                                      - PARSE_ERROR when not successful
85
 
         */
86
 
        status_t (*parse_uint8)  (private_parser_t *this, int rule_number, u_int8_t *output_pos);
87
 
        
88
 
        /**
89
 
         * Parse a 15-Bit unsigned integer from the current parsing position.
90
 
         * 
91
 
         * This is a special case used for ATTRIBUTE_TYPE.
92
 
         * Big-/Little-endian conversion is done here.
93
 
         * 
94
 
         * @param this                          parser_t object
95
 
         * @param rule_number           number of current rule
96
 
         * @param[out] output_pos       pointer where to write the parsed result
97
 
         * @return                                      
98
 
         *                                                      - SUCCESS or
99
 
         *                                                      - PARSE_ERROR when not successful
100
 
         */
101
 
        status_t (*parse_uint15) (private_parser_t *this, int rule_number, u_int16_t *output_pos);
102
 
        
103
 
        /**
104
 
         * Parse a 16-Bit unsigned integer from the current parsing position.
105
 
         * 
106
 
         * Big-/Little-endian conversion is done here.
107
 
         * 
108
 
         * @param this                          parser_t object
109
 
         * @param rule_number           number of current rule
110
 
         * @param[out] output_pos       pointer where to write the parsed result
111
 
         * @return                                      
112
 
         *                                                      - SUCCESS or
113
 
         *                                                      - PARSE_ERROR when not successful
114
 
         */
115
 
        status_t (*parse_uint16) (private_parser_t *this, int rule_number, u_int16_t *output_pos);
116
 
        
117
 
        /**
118
 
         * Parse a 32-Bit unsigned integer from the current parsing position.
119
 
         * 
120
 
         * Big-/Little-endian conversion is done here.
121
 
         * 
122
 
         * @param this                          parser_t object
123
 
         * @param rule_number           number of current rule
124
 
         * @param[out] output_pos       pointer where to write the parsed result
125
 
         * @return                                      
126
 
         *                                                      - SUCCESS or
127
 
         *                                                      - PARSE_ERROR when not successful
128
 
         */
129
 
        status_t (*parse_uint32) (private_parser_t *this, int rule_number, u_int32_t *output_pos);
130
 
        
131
 
        /**
132
 
         * Parse a 64-Bit unsigned integer from the current parsing position.
133
 
         * 
134
 
         * @todo add support for big-endian machines.
135
 
         * 
136
 
         * @param this                          parser_t object
137
 
         * @param rule_number           number of current rule
138
 
         * @param[out] output_pos       pointer where to write the parsed result
139
 
         * @return                                      
140
 
         *                                                      - SUCCESS or
141
 
         *                                                      - PARSE_ERROR when not successful
142
 
         */
143
 
        status_t (*parse_uint64) (private_parser_t *this, int rule_number, u_int64_t *output_pos);
144
 
        
145
 
        /**
146
 
         * Parse a given amount of bytes and writes them to a specific location
147
 
         * 
148
 
         * @param this                          parser_t object
149
 
         * @param rule_number           number of current rule
150
 
         * @param[out] output_pos       pointer where to write the parsed result
151
 
         * @param bytes                         number of bytes to parse
152
 
         * @return                                      
153
 
         *                                                      - SUCCESS or
154
 
         *                                                      - PARSE_ERROR when not successful
155
 
         */
156
 
        status_t (*parse_bytes) (private_parser_t *this, int rule_number, u_int8_t *output_pos,size_t bytes);
157
 
        
158
 
        /**
159
 
         * Parse a single Bit from the current parsing position
160
 
         * 
161
 
         * @param this                          parser_t object
162
 
         * @param rule_number           number of current rule
163
 
         * @param[out] output_pos       pointer where to write the parsed result
164
 
         * @return                                      
165
 
         *                                                      - SUCCESS or
166
 
         *                                                      - PARSE_ERROR when not successful
167
 
         */
168
 
        status_t (*parse_bit)    (private_parser_t *this, int rule_number, bool *output_pos);
169
 
        
170
 
        /**
171
 
         * Parse substructures in a list
172
 
         * 
173
 
         * This function calls the parser recursively to parse contained substructures
174
 
         * in a linked_list_t. The list must already be created. Payload defines
175
 
         * the type of the substructures. parsing is continued until the specified length
176
 
         * is completely parsed.
177
 
         * 
178
 
         * @param this                          parser_t object
179
 
         * @param rule_number           number of current rule
180
 
         * @param[out] output_pos       pointer of a linked_list where substructures are added
181
 
         * @param payload_type          type of the contained substructures to parse
182
 
         * @param length                        number of bytes to parse in this list
183
 
         * @return                                      
184
 
         *                                                      - SUCCESS or
185
 
         *                                                      - PARSE_ERROR when not successful
186
 
         */
187
 
        status_t (*parse_list)   (private_parser_t *this, int rule_number, linked_list_t **output_pos, payload_type_t payload_ype, size_t length);
188
 
        
189
 
        /**
190
 
         * Parse data from current parsing position in a chunk.
191
 
         * 
192
 
         * This function clones length number of bytes to output_pos, without 
193
 
         * modifiyng them. Space will be allocated and must be freed by caller.
194
 
         * 
195
 
         * @param this                          parser_t object
196
 
         * @param rule_number           number of current rule
197
 
         * @param[out] output_pos       pointer of a chunk which will point to the allocated data
198
 
         * @param length                        number of bytes to clone
199
 
         * @return                                      
200
 
         *                                                      - SUCCESS or
201
 
         *                                                      - PARSE_ERROR when not successful
202
 
         */
203
 
        status_t (*parse_chunk)  (private_parser_t *this, int rule_number, chunk_t *output_pos, size_t length);
204
 
 
205
 
        /**
206
65
         * Current bit for reading in input data.
207
66
         */
208
67
        u_int8_t bit_pos;
229
88
};
230
89
 
231
90
/**
232
 
 * Implementation of private_parser_t.parse_uint4.
 
91
 * Parse a 4-Bit unsigned integer from the current parsing position.
233
92
 */
234
93
static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *output_pos)
235
94
{
274
133
}
275
134
 
276
135
/**
277
 
 * Implementation of private_parser_t.parse_uint8.
 
136
 * Parse a 8-Bit unsigned integer from the current parsing position.
278
137
 */
279
138
static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *output_pos)
280
139
{
304
163
}
305
164
 
306
165
/**
307
 
 * Implementation of private_parser_t.parse_uint15.
 
166
 * Parse a 15-Bit unsigned integer from the current parsing position.
308
167
 */
309
168
static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t *output_pos)
310
169
{
333
192
}
334
193
 
335
194
/**
336
 
 * Implementation of private_parser_t.parse_uint16.
 
195
 * Parse a 16-Bit unsigned integer from the current parsing position.
337
196
 */
338
197
static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t *output_pos)
339
198
{
361
220
        return SUCCESS;
362
221
}
363
222
/**
364
 
 * Implementation of private_parser_t.parse_uint32.
 
223
 * Parse a 32-Bit unsigned integer from the current parsing position.
365
224
 */
366
225
static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t *output_pos)
367
226
{
390
249
}
391
250
 
392
251
/**
393
 
 * Implementation of private_parser_t.parse_uint64.
 
252
 * Parse a 64-Bit unsigned integer from the current parsing position.
394
253
 */
395
254
static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t *output_pos)
396
255
{
421
280
}
422
281
 
423
282
/**
424
 
 * Implementation of private_parser_t.parse_bytes.
 
283
 * Parse a given amount of bytes and writes them to a specific location
425
284
 */
426
285
static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t *output_pos,size_t bytes)
427
286
{
451
310
}
452
311
 
453
312
/**
454
 
 * Implementation of private_parser_t.parse_bit.
 
313
 * Parse a single Bit from the current parsing position
455
314
 */
456
315
static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_pos)
457
316
{
486
345
}
487
346
 
488
347
/**
489
 
 * Implementation of private_parser_t.parse_list.
 
348
 * Parse substructures in a list.
490
349
 */
491
350
static status_t parse_list(private_parser_t *this, int rule_number, linked_list_t **output_pos, payload_type_t payload_type, size_t length)
492
351
{
528
387
}
529
388
 
530
389
/**
531
 
 * Implementation of private_parser_t.parse_chunk.
 
390
 * Parse data from current parsing position in a chunk.
532
391
 */
533
392
static status_t parse_chunk(private_parser_t *this, int rule_number, chunk_t *output_pos, size_t length)
534
393
{
598
457
                {
599
458
                        case U_INT_4:
600
459
                        {
601
 
                                if (this->parse_uint4(this, rule_number, output + rule->offset) != SUCCESS) 
 
460
                                if (parse_uint4(this, rule_number, output + rule->offset) != SUCCESS) 
602
461
                                {
603
462
                                        pld->destroy(pld);
604
463
                                        return PARSE_ERROR;
607
466
                        }
608
467
                        case U_INT_8:
609
468
                        {
610
 
                                if (this->parse_uint8(this, rule_number, output + rule->offset) != SUCCESS) 
 
469
                                if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS) 
611
470
                                {
612
471
                                        pld->destroy(pld);
613
472
                                        return PARSE_ERROR;
616
475
                        }
617
476
                        case U_INT_16:
618
477
                        {
619
 
                                if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
 
478
                                if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
620
479
                                {
621
480
                                        pld->destroy(pld);
622
481
                                        return PARSE_ERROR;
625
484
                        }
626
485
                        case U_INT_32:
627
486
                        {
628
 
                                if (this->parse_uint32(this, rule_number, output + rule->offset) != SUCCESS) 
 
487
                                if (parse_uint32(this, rule_number, output + rule->offset) != SUCCESS) 
629
488
                                {
630
489
                                        pld->destroy(pld);
631
490
                                        return PARSE_ERROR;
634
493
                        }
635
494
                        case U_INT_64:
636
495
                        {
637
 
                                if (this->parse_uint64(this, rule_number, output + rule->offset) != SUCCESS) 
 
496
                                if (parse_uint64(this, rule_number, output + rule->offset) != SUCCESS) 
638
497
                                {
639
498
                                        pld->destroy(pld);
640
499
                                        return PARSE_ERROR;
643
502
                        }
644
503
                        case IKE_SPI:
645
504
                        {
646
 
                                if (this->parse_bytes(this, rule_number, output + rule->offset,8) != SUCCESS) 
 
505
                                if (parse_bytes(this, rule_number, output + rule->offset,8) != SUCCESS) 
647
506
                                {
648
507
                                        pld->destroy(pld);
649
508
                                        return PARSE_ERROR;
652
511
                        }
653
512
                        case RESERVED_BIT:
654
513
                        {
655
 
                                if (this->parse_bit(this, rule_number, NULL) != SUCCESS) 
 
514
                                if (parse_bit(this, rule_number, NULL) != SUCCESS) 
656
515
                                {
657
516
                                        pld->destroy(pld);
658
517
                                        return PARSE_ERROR;
661
520
                        }
662
521
                        case RESERVED_BYTE:
663
522
                        {
664
 
                                if (this->parse_uint8(this, rule_number, NULL) != SUCCESS) 
 
523
                                if (parse_uint8(this, rule_number, NULL) != SUCCESS) 
665
524
                                {
666
525
                                        pld->destroy(pld);
667
526
                                        return PARSE_ERROR;
670
529
                        }
671
530
                        case FLAG:
672
531
                        {
673
 
                                if (this->parse_bit(this, rule_number, output + rule->offset) != SUCCESS) 
 
532
                                if (parse_bit(this, rule_number, output + rule->offset) != SUCCESS) 
674
533
                                {
675
534
                                        pld->destroy(pld);
676
535
                                        return PARSE_ERROR;
679
538
                        }
680
539
                        case PAYLOAD_LENGTH:
681
540
                        {
682
 
                                if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
 
541
                                if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
683
542
                                {
684
543
                                        pld->destroy(pld);
685
544
                                        return PARSE_ERROR;
694
553
                        }
695
554
                        case HEADER_LENGTH:
696
555
                        {
697
 
                                if (this->parse_uint32(this, rule_number, output + rule->offset) != SUCCESS) 
 
556
                                if (parse_uint32(this, rule_number, output + rule->offset) != SUCCESS) 
698
557
                                {
699
558
                                        pld->destroy(pld);
700
559
                                        return PARSE_ERROR;
703
562
                        }
704
563
                        case SPI_SIZE:
705
564
                        {
706
 
                                if (this->parse_uint8(this, rule_number, output + rule->offset) != SUCCESS) 
 
565
                                if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS) 
707
566
                                {
708
567
                                        pld->destroy(pld);
709
568
                                        return PARSE_ERROR;
713
572
                        }
714
573
                        case SPI:
715
574
                        {
716
 
                                if (this->parse_chunk(this, rule_number, output + rule->offset, spi_size) != SUCCESS) 
 
575
                                if (parse_chunk(this, rule_number, output + rule->offset, spi_size) != SUCCESS) 
717
576
                                {
718
577
                                        pld->destroy(pld);
719
578
                                        return PARSE_ERROR;
723
582
                        case PROPOSALS:
724
583
                        {
725
584
                                if (payload_length < SA_PAYLOAD_HEADER_LENGTH ||
726
 
                                        this->parse_list(this, rule_number, output + rule->offset, PROPOSAL_SUBSTRUCTURE,
 
585
                                        parse_list(this, rule_number, output + rule->offset, PROPOSAL_SUBSTRUCTURE,
727
586
                                                payload_length - SA_PAYLOAD_HEADER_LENGTH) != SUCCESS)
728
587
                                {
729
588
                                        pld->destroy(pld);
734
593
                        case TRANSFORMS:
735
594
                        {
736
595
                                if (payload_length < spi_size + PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH ||
737
 
                                        this->parse_list(this, rule_number, output + rule->offset, TRANSFORM_SUBSTRUCTURE,
 
596
                                        parse_list(this, rule_number, output + rule->offset, TRANSFORM_SUBSTRUCTURE,
738
597
                                                payload_length - spi_size - PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH) != SUCCESS)
739
598
                                {
740
599
                                        pld->destroy(pld);
745
604
                        case TRANSFORM_ATTRIBUTES:
746
605
                        {
747
606
                                if (payload_length < TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH ||
748
 
                                        this->parse_list(this, rule_number, output + rule->offset, TRANSFORM_ATTRIBUTE,
 
607
                                        parse_list(this, rule_number, output + rule->offset, TRANSFORM_ATTRIBUTE,
749
608
                                                payload_length - TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH) != SUCCESS)
750
609
                                {
751
610
                                        pld->destroy(pld);
756
615
                        case CONFIGURATION_ATTRIBUTES:
757
616
                        {
758
617
                                if (payload_length < CP_PAYLOAD_HEADER_LENGTH ||
759
 
                                        this->parse_list(this, rule_number, output + rule->offset, CONFIGURATION_ATTRIBUTE,
 
618
                                        parse_list(this, rule_number, output + rule->offset, CONFIGURATION_ATTRIBUTE,
760
619
                                                payload_length - CP_PAYLOAD_HEADER_LENGTH) != SUCCESS)
761
620
                                {
762
621
                                        pld->destroy(pld);
766
625
                        }
767
626
                        case ATTRIBUTE_FORMAT:
768
627
                        {
769
 
                                if (this->parse_bit(this, rule_number, output + rule->offset) != SUCCESS) 
 
628
                                if (parse_bit(this, rule_number, output + rule->offset) != SUCCESS) 
770
629
                                {
771
630
                                        pld->destroy(pld);
772
631
                                        return PARSE_ERROR;
776
635
                        }
777
636
                        case ATTRIBUTE_TYPE:
778
637
                        {
779
 
                                if (this->parse_uint15(this, rule_number, output + rule->offset) != SUCCESS) 
 
638
                                if (parse_uint15(this, rule_number, output + rule->offset) != SUCCESS) 
780
639
                                {
781
640
                                        pld->destroy(pld);
782
641
                                        return PARSE_ERROR;
786
645
                        }
787
646
                        case CONFIGURATION_ATTRIBUTE_LENGTH:
788
647
                        {
789
 
                                if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
 
648
                                if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
790
649
                                {
791
650
                                        pld->destroy(pld);
792
651
                                        return PARSE_ERROR;
796
655
                        }
797
656
                        case ATTRIBUTE_LENGTH_OR_VALUE:
798
657
                        {       
799
 
                                if (this->parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
 
658
                                if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS) 
800
659
                                {
801
660
                                        pld->destroy(pld);
802
661
                                        return PARSE_ERROR;
808
667
                        {
809
668
                                if (attribute_format == FALSE)
810
669
                                {
811
 
                                        if (this->parse_chunk(this, rule_number, output + rule->offset, attribute_length) != SUCCESS) 
 
670
                                        if (parse_chunk(this, rule_number, output + rule->offset, attribute_length) != SUCCESS) 
812
671
                                        {
813
672
                                                pld->destroy(pld);
814
673
                                                return PARSE_ERROR;
819
678
                        case NONCE_DATA:
820
679
                        {
821
680
                                if (payload_length < NONCE_PAYLOAD_HEADER_LENGTH ||
822
 
                                        this->parse_chunk(this, rule_number, output + rule->offset, 
 
681
                                        parse_chunk(this, rule_number, output + rule->offset, 
823
682
                                                payload_length - NONCE_PAYLOAD_HEADER_LENGTH) != SUCCESS)
824
683
                                {
825
684
                                        pld->destroy(pld);
830
689
                        case ID_DATA:
831
690
                        {
832
691
                                if (payload_length < ID_PAYLOAD_HEADER_LENGTH ||
833
 
                                        this->parse_chunk(this, rule_number, output + rule->offset,
 
692
                                        parse_chunk(this, rule_number, output + rule->offset,
834
693
                                                payload_length - ID_PAYLOAD_HEADER_LENGTH) != SUCCESS)
835
694
                                {
836
695
                                        pld->destroy(pld);
841
700
                        case AUTH_DATA:
842
701
                        {
843
702
                                if (payload_length < AUTH_PAYLOAD_HEADER_LENGTH ||
844
 
                                        this->parse_chunk(this, rule_number, output + rule->offset,
 
703
                                        parse_chunk(this, rule_number, output + rule->offset,
845
704
                                                payload_length - AUTH_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
846
705
                                {
847
706
                                        pld->destroy(pld);
852
711
                        case CERT_DATA:
853
712
                        {
854
713
                                if (payload_length < CERT_PAYLOAD_HEADER_LENGTH ||
855
 
                                        this->parse_chunk(this, rule_number, output + rule->offset, 
 
714
                                        parse_chunk(this, rule_number, output + rule->offset, 
856
715
                                                payload_length - CERT_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
857
716
                                {
858
717
                                        pld->destroy(pld);
863
722
                        case CERTREQ_DATA:
864
723
                        {
865
724
                                if (payload_length < CERTREQ_PAYLOAD_HEADER_LENGTH ||
866
 
                                        this->parse_chunk(this, rule_number, output + rule->offset, 
 
725
                                        parse_chunk(this, rule_number, output + rule->offset, 
867
726
                                                payload_length - CERTREQ_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
868
727
                                {
869
728
                                        pld->destroy(pld);
874
733
                        case EAP_DATA:
875
734
                        {
876
735
                                if (payload_length < EAP_PAYLOAD_HEADER_LENGTH ||
877
 
                                        this->parse_chunk(this, rule_number, output + rule->offset, 
 
736
                                        parse_chunk(this, rule_number, output + rule->offset, 
878
737
                                                payload_length - EAP_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
879
738
                                {
880
739
                                        pld->destroy(pld);
885
744
                        case SPIS:
886
745
                        {
887
746
                                if (payload_length < DELETE_PAYLOAD_HEADER_LENGTH ||
888
 
                                        this->parse_chunk(this, rule_number, output + rule->offset,
 
747
                                        parse_chunk(this, rule_number, output + rule->offset,
889
748
                                                payload_length - DELETE_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
890
749
                                {
891
750
                                        pld->destroy(pld);
896
755
                        case VID_DATA:
897
756
                        {
898
757
                                if (payload_length < VENDOR_ID_PAYLOAD_HEADER_LENGTH ||
899
 
                                        this->parse_chunk(this, rule_number, output + rule->offset,
 
758
                                        parse_chunk(this, rule_number, output + rule->offset,
900
759
                                                payload_length - VENDOR_ID_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
901
760
                                {
902
761
                                        pld->destroy(pld);
907
766
                        case CONFIGURATION_ATTRIBUTE_VALUE:
908
767
                        {
909
768
                                size_t data_length = attribute_length;
910
 
                                if (this->parse_chunk(this, rule_number, output + rule->offset, data_length) != SUCCESS) 
 
769
                                if (parse_chunk(this, rule_number, output + rule->offset, data_length) != SUCCESS) 
911
770
                                {
912
771
                                        pld->destroy(pld);
913
772
                                        return PARSE_ERROR;
917
776
                        case KEY_EXCHANGE_DATA:
918
777
                        {
919
778
                                if (payload_length < KE_PAYLOAD_HEADER_LENGTH ||
920
 
                                        this->parse_chunk(this, rule_number, output + rule->offset,
 
779
                                        parse_chunk(this, rule_number, output + rule->offset,
921
780
                                                payload_length - KE_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
922
781
                                {
923
782
                                        pld->destroy(pld);
928
787
                        case NOTIFICATION_DATA:
929
788
                        {
930
789
                                if (payload_length < NOTIFY_PAYLOAD_HEADER_LENGTH + spi_size ||
931
 
                                        this->parse_chunk(this, rule_number, output + rule->offset, 
 
790
                                        parse_chunk(this, rule_number, output + rule->offset, 
932
791
                                                payload_length - NOTIFY_PAYLOAD_HEADER_LENGTH - spi_size) != SUCCESS) 
933
792
                                {
934
793
                                        pld->destroy(pld);
939
798
                        case ENCRYPTED_DATA:
940
799
                        {                               
941
800
                                if (payload_length < ENCRYPTION_PAYLOAD_HEADER_LENGTH ||
942
 
                                        this->parse_chunk(this, rule_number, output + rule->offset,
 
801
                                        parse_chunk(this, rule_number, output + rule->offset,
943
802
                                                payload_length - ENCRYPTION_PAYLOAD_HEADER_LENGTH) != SUCCESS) 
944
803
                                {
945
804
                                        pld->destroy(pld);
949
808
                        }
950
809
                        case TS_TYPE:
951
810
                        {
952
 
                                if (this->parse_uint8(this, rule_number, output + rule->offset) != SUCCESS) 
 
811
                                if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS) 
953
812
                                {
954
813
                                        pld->destroy(pld);
955
814
                                        return PARSE_ERROR;
960
819
                        case ADDRESS:
961
820
                        {
962
821
                                size_t address_length = (ts_type == TS_IPV4_ADDR_RANGE) ? 4 : 16;
963
 
                                if (this->parse_chunk(this, rule_number, output + rule->offset,address_length) != SUCCESS) 
 
822
                                if (parse_chunk(this, rule_number, output + rule->offset,address_length) != SUCCESS) 
964
823
                                {
965
824
                                        pld->destroy(pld);
966
825
                                        return PARSE_ERROR;
970
829
                        case TRAFFIC_SELECTORS:
971
830
                        {
972
831
                                if (payload_length < TS_PAYLOAD_HEADER_LENGTH ||
973
 
                                        this->parse_list(this, rule_number, output + rule->offset, TRAFFIC_SELECTOR_SUBSTRUCTURE,
 
832
                                        parse_list(this, rule_number, output + rule->offset, TRAFFIC_SELECTOR_SUBSTRUCTURE,
974
833
                                                payload_length - TS_PAYLOAD_HEADER_LENGTH) != SUCCESS)
975
834
                                {
976
835
                                        pld->destroy(pld);
981
840
                        case UNKNOWN_DATA:
982
841
                        {
983
842
                                if (payload_length < UNKNOWN_PAYLOAD_HEADER_LENGTH ||
984
 
                                        this->parse_chunk(this, rule_number, output + rule->offset,
 
843
                                        parse_chunk(this, rule_number, output + rule->offset,
985
844
                                                payload_length - UNKNOWN_PAYLOAD_HEADER_LENGTH) != SUCCESS)
986
845
                                {
987
846
                                        pld->destroy(pld);
1045
904
        this->public.get_remaining_byte_count = (int (*) (parser_t *))get_remaining_byte_count;
1046
905
        this->public.destroy = (void(*)(parser_t*)) destroy;
1047
906
        
1048
 
        this->parse_uint4 = parse_uint4;
1049
 
        this->parse_uint8 = parse_uint8;
1050
 
        this->parse_uint15 = parse_uint15;
1051
 
        this->parse_uint16 = parse_uint16;
1052
 
        this->parse_uint32 = parse_uint32;
1053
 
        this->parse_uint64 = parse_uint64;
1054
 
        this->parse_bytes = parse_bytes;
1055
 
        this->parse_bit = parse_bit;
1056
 
        this->parse_list = parse_list;
1057
 
        this->parse_chunk = parse_chunk;
1058
 
        
1059
907
        this->input = data.ptr;
1060
908
        this->byte_pos = data.ptr;
1061
909
        this->bit_pos = 0;