aboutsummaryrefslogtreecommitdiffstats
path: root/frame_tvbuff.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-07-16 15:37:06 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-07-16 15:37:06 +0000
commit70cac937e8e090ce312d96af7873eae091c94c43 (patch)
tree8cf740983fd8cb63c5a7c843c4a9d87635f866e8 /frame_tvbuff.c
parent02fa8a5d19206e1efdef7838726768e9113f23fd (diff)
Fix Coverity CID 1050093: Dereference before null check.
svn path=/trunk/; revision=50668
Diffstat (limited to 'frame_tvbuff.c')
-rw-r--r--frame_tvbuff.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/frame_tvbuff.c b/frame_tvbuff.c
index 124fd094f3..0a3652a17a 100644
--- a/frame_tvbuff.c
+++ b/frame_tvbuff.c
@@ -145,8 +145,8 @@ frame_pbrk_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, const guint8 *ne
static gsize
frame_sizeof(void)
-{
- return sizeof(struct tvb_frame);
+{
+ return sizeof(struct tvb_frame);
}
static guint
@@ -196,13 +196,19 @@ frame_tvbuff_new(const frame_data *fd, const guint8 *buf)
*
* For now, we clip the reported length at G_MAXINT
*
- * (XXX, is this still a problem?) There was an exception when we call
+ * (XXX, is this still a problem?) There was an exception when we call
* tvb_new_real_data() now there's no one
*/
tvb->real_data = buf;
- tvb->length = fd->cap_len;
- tvb->reported_length = fd->pkt_len > G_MAXINT ? G_MAXINT : fd->pkt_len;
+ if (fd) {
+ tvb->length = fd->cap_len;
+ tvb->reported_length = fd->pkt_len > G_MAXINT ? G_MAXINT : fd->pkt_len;
+ } else {
+ tvb->length = 0;
+ tvb->reported_length = 0;
+ }
+
tvb->initialized = TRUE;
/*