Break out of an infinite loop. Fixes bugs 392 - 395. Add a UNIX Makefile

for generation of the PRES dissector.

svn path=/trunk/; revision=15626
This commit is contained in:
Gerald Combs 2005-08-30 19:43:32 +00:00
parent 2da0e86244
commit e66bb9e691
4 changed files with 29 additions and 14 deletions

17
asn1/pres/Makefile Normal file
View File

@ -0,0 +1,17 @@
# $Id: Makefile 15178 2005-08-02 05:21:19Z jmayer $
DISSECTOR_FILES=packet-pres.c packet-pres.h
all: generate_dissector
generate_dissector: $(DISSECTOR_FILES)
$(DISSECTOR_FILES): ../../tools/asn2eth.py ISO8823-PRESENTATION.asn packet-pres-template.c packet-pres-template.h pres.cnf
python ../../tools/asn2eth.py -X -b -e -p pres -c pres.cnf -s packet-pres-template ISO8823-PRESENTATION.asn
clean:
rm -f parsetab.py $(DISSECTOR_FILES)
copy_files: generate_dissector
cp $(DISSECTOR_FILES) ../../epan/dissectors

View File

@ -136,7 +136,7 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
void
dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
int offset = 0;
int offset = 0, old_offset;
/* first, try to check length */
/* do we have at least 4 bytes */
if (!tvb_bytes_exist(tvb, 0, 4)){
@ -157,12 +157,11 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
global_pinfo = pinfo;
while (tvb_reported_length_remaining(tvb, offset) > 0){
old_offset = offset;
offset = dissect_ppdu(tvb, offset, pinfo, parent_tree);
if(offset == FALSE ){
proto_tree_add_text(parent_tree, tvb, offset, -1,"Internal error");
offset = tvb_length(tvb);
break;
if(offset <= old_offset){
proto_tree_add_text(parent_tree, tvb, offset, -1,"Invalid offset");
THROW(ReportedBoundsError);
}
}
}

View File

@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Ethereal dissector compiler */
/* .\packet-pres.c */
/* ./packet-pres.c */
/* ../../tools/asn2eth.py -X -b -e -p pres -c pres.cnf -s packet-pres-template ISO8823-PRESENTATION.asn */
/* Input file: packet-pres-template.c */
@ -1687,7 +1687,7 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
void
dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
int offset = 0;
int offset = 0, old_offset;
/* first, try to check length */
/* do we have at least 4 bytes */
if (!tvb_bytes_exist(tvb, 0, 4)){
@ -1708,12 +1708,11 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
global_pinfo = pinfo;
while (tvb_reported_length_remaining(tvb, offset) > 0){
old_offset = offset;
offset = dissect_ppdu(tvb, offset, pinfo, parent_tree);
if(offset == FALSE ){
proto_tree_add_text(parent_tree, tvb, offset, -1,"Internal error");
offset = tvb_length(tvb);
break;
if(offset <= old_offset){
proto_tree_add_text(parent_tree, tvb, offset, -1,"Invalid offset");
THROW(ReportedBoundsError);
}
}
}

View File

@ -1,6 +1,6 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Ethereal dissector compiler */
/* .\packet-pres.h */
/* ./packet-pres.h */
/* ../../tools/asn2eth.py -X -b -e -p pres -c pres.cnf -s packet-pres-template ISO8823-PRESENTATION.asn */
/* Input file: packet-pres-template.h */