diff options
author | Gerald Combs <gerald@wireshark.org> | 2005-10-16 20:40:27 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2005-10-16 20:40:27 +0000 |
commit | 2544a95b7fdf617cf03eb9e266ff805ad2cfba2d (patch) | |
tree | 2a5ed7d1c7193c8d7912f4c861ec5c7cb5fab7a3 /epan/dissectors/packet-ncp2222.inc | |
parent | 1d65dc39c5e7b0ffbcc1b9133dd6e0fadde0532b (diff) |
Break out of an infinite loop. Fixes bug 535. Remove an unused
function (which had a buffer overflow!) Initialize a variable flagged
by Valgrind.
svn path=/trunk/; revision=16247
Diffstat (limited to 'epan/dissectors/packet-ncp2222.inc')
-rw-r--r-- | epan/dissectors/packet-ncp2222.inc | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index 5feb405434..f427f944f1 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -1096,29 +1096,6 @@ uint_to_nwtime(guint data, nw_time_t *nwtime) nwtime->hour = ((data & 0xf800) >> 11); } -static char * -unicode_to_string(char * data, guint32 length) -{ - guint32 i; - guint16 character; - int offset = 0; - char * buffer = ""; - - if (data[1] == 0x00){ - - for (i = 0; i < length; i++) { - character = data[offset]; - buffer[i] = character & 0xff; - offset += 2; - } - } - else - { - buffer = data; - } - return buffer; -} - static proto_item* padd_normal(ptvcursor_t *ptvc, const ptvc_record *rec) { @@ -1127,7 +1104,6 @@ padd_normal(ptvcursor_t *ptvc, const ptvc_record *rec) rec->length, rec->endianness); } - static proto_item* padd_date(ptvcursor_t *ptvc, const ptvc_record *rec) { @@ -1798,7 +1774,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val { if (oldvoffset >= voffset) { proto_tree_add_text(nvtree, tvb, 0, 0, "[ Invalid offset: %u ]", voffset); - return; + THROW(ReportedBoundsError); } oldvoffset = voffset; switch(syntax_type) @@ -2925,7 +2901,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, nds_val *values) { if (oldioffset >= ioffset) { proto_tree_add_text(ntree, tvb, 0, 0, "[ Invalid offset: %u ]", ioffset); - return; + THROW(ReportedBoundsError); } oldioffset = ioffset; ioffset += align_4(tvb, ioffset); @@ -3370,6 +3346,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, nds_val *values) for (r = 0 ; r < 32; r++ ) { + oldioffset = ioffset; if (values->vflags & bvalue) { switch(bvalue) @@ -3651,6 +3628,10 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, nds_val *values) } ioffset += align_4(tvb, ioffset); } + if (oldioffset >= ioffset) { + proto_tree_add_text(ntree, tvb, 0, 0, "[ Invalid offset: %u ]", ioffset); + THROW(ReportedBoundsError); + } bvalue = bvalue*2; if(tvb_length_remaining(tvb, ioffset) < 4 ) { @@ -6148,6 +6129,7 @@ dissect_nds_request(tvbuff_t *tvb, packet_info *pinfo, string_buffer[i][0] = '\0'; pvalues[i].vstring = string_buffer[i]; pvalues[i].mvtype = 0; + pvalues[i].vflags = 0; } strcpy(req_buffer.buffer, ""); |