From Steve Grubb: Fix buffer and array length checks. Fixes part of bug 217.

svn path=/trunk/; revision=14498
This commit is contained in:
Gerald Combs 2005-05-30 21:01:52 +00:00
parent 923446f1f5
commit bcd1c5b9fa
2 changed files with 2 additions and 2 deletions

View File

@ -412,7 +412,7 @@ DEBUG_ENTRY("dissect_per_restricted_character_string");
}
str[char_pos]=0;
proto_tree_add_string(tree, hf_index, tvb, (old_offset>>3), (offset>>3)-(old_offset>>3), str);
if (info_str != NULL) {
if (info_str != NULL && info_str_len > 0) {
if (info_str_len<length) str[info_str_len-1] = '\0';
strcpy(info_str, str);
}

View File

@ -4241,7 +4241,7 @@ dissect_attribute_value_pairs(tvbuff_t *tvb, int offset,proto_tree *tree,
rd_value_to_str(textbuffer, &vsabuffer, &avph, tvb, offset,
attr_info, vsa_tree);
proto_item_append_text(ti, ", %s", textbuffer);
for (i = 0; vsabuffer[i].str && i < VSABUFFER; i++) {
for (i = 0; i < VSABUFFER && vsabuffer[i].str; i++) {
proto_tree_add_text(vsa_tree, tvb, vsabuffer[i].offset,
vsabuffer[i].length, "%s", vsabuffer[i].str);
}