Callers of tvb_per_bit_string expect that the returned value_tvb is non-NULL.

Ensure that is the case even in certain peculiar error conditions, by filling it
with a 0-length subset TVB. Fixes
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9117

Also add modelines.

svn path=/trunk/; revision=51821
This commit is contained in:
Evan Huus 2013-09-07 13:48:13 +00:00
parent a1d88c4620
commit e69ec10794
1 changed files with 18 additions and 0 deletions

View File

@ -2063,9 +2063,15 @@ dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tr
hfi = (hf_index==-1) ? NULL : proto_registrar_get_nth(hf_index);
/* Start with something because callers expect value_tvb to be non-NULL,
* so we need a non-NULL empty tvb for error cases. */
out_tvb = tvb_new_subset(tvb, offset, 0, 0);
DEBUG_ENTRY("dissect_per_bit_string");
/* 15.8 if the length is 0 bytes there will be no encoding */
if(max_len==0) {
if (value_tvb)
*value_tvb = out_tvb;
return offset;
}
@ -2638,3 +2644,15 @@ proto_reg_handoff_per(void)
{
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/