diff options
Diffstat (limited to 'epan/dissectors/packet-dcerpc-ndr.c')
-rw-r--r-- | epan/dissectors/packet-dcerpc-ndr.c | 105 |
1 files changed, 30 insertions, 75 deletions
diff --git a/epan/dissectors/packet-dcerpc-ndr.c b/epan/dissectors/packet-dcerpc-ndr.c index 0f4b253bed..a64eb5be77 100644 --- a/epan/dissectors/packet-dcerpc-ndr.c +++ b/epan/dissectors/packet-dcerpc-ndr.c @@ -40,17 +40,14 @@ int dissect_ndr_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint8 *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -63,13 +60,11 @@ dissect_ndr_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint8_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param, guint8 *pval) { - dcerpc_info *di; guint8 val; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -118,26 +113,23 @@ PIDL_dissect_uint8_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param) { - return PIDL_dissect_uint8_val(tvb, offset, pinfo, tree, drep, hfindex, param, NULL); + return PIDL_dissect_uint8_val(tvb, offset, pinfo, tree, di, drep, hfindex, param, NULL); } int dissect_ndr_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint16 *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -153,13 +145,11 @@ dissect_ndr_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint16_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param, guint16 *pval) { - dcerpc_info *di; guint16 val; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -211,32 +201,29 @@ PIDL_dissect_uint16_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param _U_) { - return PIDL_dissect_uint16_val(tvb, offset, pinfo, tree, drep, hfindex, param, NULL); + return PIDL_dissect_uint16_val(tvb, offset, pinfo, tree, di, drep, hfindex, param, NULL); } int dissect_ndr_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; - if (di->conformant_run) { + if ((di != NULL) && (di->conformant_run)) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; } - if (!di->no_align && (offset % 4)) { + if ((di != NULL) && (!di->no_align) && (offset % 4)) { offset += 4 - (offset % 4); } return dissect_dcerpc_uint32(tvb, offset, pinfo, @@ -248,18 +235,14 @@ dissect_ndr_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo, */ int dissect_ndr_uint3264(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint3264 *pdata) { - dcerpc_info *di; - - di = (dcerpc_info *)pinfo->private_data; - if (di->call_data->flags & DCERPC_IS_NDR64) { - return dissect_ndr_uint64(tvb, offset, pinfo, tree, drep, hfindex, pdata); + return dissect_ndr_uint64(tvb, offset, pinfo, tree, di, drep, hfindex, pdata); } else { guint32 val = 0; - offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hfindex, &val); + offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hfindex, &val); if (pdata) { *pdata = val; } @@ -272,18 +255,14 @@ dissect_ndr_uint3264(tvbuff_t *tvb, gint offset, packet_info *pinfo, */ int dissect_ndr_uint1632(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint1632 *pdata) { - dcerpc_info *di; - - di = (dcerpc_info *)pinfo->private_data; - if (di->call_data->flags & DCERPC_IS_NDR64) { - return dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hfindex, pdata); + return dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hfindex, pdata); } else { guint16 val = 0; - offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep, hfindex, &val); + offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, di, drep, hfindex, &val); if (pdata) { *pdata = val; } @@ -293,13 +272,11 @@ dissect_ndr_uint1632(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint32_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param, guint32 *rval) { - dcerpc_info *di; guint32 val; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -350,10 +327,10 @@ PIDL_dissect_uint32_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param) { - return PIDL_dissect_uint32_val(tvb, offset, pinfo, tree, drep, hfindex, param, NULL); + return PIDL_dissect_uint32_val(tvb, offset, pinfo, tree, di, drep, hfindex, param, NULL); } /* Double uint32 @@ -363,17 +340,14 @@ PIDL_dissect_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo, */ int dissect_ndr_duint32(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint64 *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -391,17 +365,14 @@ dissect_ndr_duint32(tvbuff_t *tvb, gint offset, packet_info *pinfo, */ int dissect_ndr_uint64(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint64 *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -419,13 +390,11 @@ dissect_ndr_uint64(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint64_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param, guint64 *pval) { - dcerpc_info *di; guint64 val; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -476,26 +445,23 @@ PIDL_dissect_uint64_val(tvbuff_t *tvb, gint offset, packet_info *pinfo, int PIDL_dissect_uint64(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param) { - return PIDL_dissect_uint64_val(tvb, offset, pinfo, tree, drep, hfindex, param, NULL); + return PIDL_dissect_uint64_val(tvb, offset, pinfo, tree, di, drep, hfindex, param, NULL); } int dissect_ndr_float(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, gfloat *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -511,17 +477,14 @@ dissect_ndr_float(tvbuff_t *tvb, gint offset, packet_info *pinfo, int dissect_ndr_double(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, gdouble *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -537,17 +500,14 @@ dissect_ndr_double(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* handles unix 32 bit time_t */ int dissect_ndr_time_t(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) *pdata = 0; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -563,17 +523,14 @@ dissect_ndr_time_t(tvbuff_t *tvb, gint offset, packet_info *pinfo, int dissect_ndr_uuid_t(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, e_uuid_t *pdata) { - dcerpc_info *di; - /* Some callers expect us to initialize pdata, even in error conditions, so * do it right away in case we forget later */ if (pdata) memset(pdata, 0, sizeof(*pdata)); - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; @@ -598,13 +555,11 @@ dissect_ndr_uuid_t(tvbuff_t *tvb, gint offset, packet_info *pinfo, */ int dissect_ndr_ctx_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *tree, guint8 *drep, + proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, e_ctx_hnd *pdata) { static e_ctx_hnd ctx_hnd; - dcerpc_info *di; - di = (dcerpc_info *)pinfo->private_data; if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; |