Ticket #8 (accepted Task)

Opened 3 years ago

Last modified 6 months ago

Handling optional fields

Reported by: matthias Owned by: kreibich
Priority: Normal Milestone:
Component: Broccoli Version: 1.5.2
Keywords: Cc:

Description

Optional fields in records are currently returned in a record with type BRO_TYPE_UNKNOWN. The Bro serialization protocol uses a NULL pointer instead. To streamline the two interfaces, it thus makes more sense to return a NULL pointer in

bro_rec_get_nth_val()

instead of an empty field instance.

Change History

comment:1 Changed 3 years ago by robin

  • Status changed from new to seen

comment:2 Changed 3 years ago by kreibich

  • Status changed from seen to accepted

comment:3 Changed 6 months ago by seth

Has this been fixed with the recent changes to broccoli?

comment:4 Changed 6 months ago by matthias

No, it's a separate issue. Christian and I are currently brainstorming how to solve it best.

comment:5 Changed 6 months ago by matthias

This may fix the issue, but I haven't tested it (yet).

diff --git a/src/bro_val.c b/src/bro_val.c
index 6efdadf..f163d0b 100644
--- a/src/bro_val.c
+++ b/src/bro_val.c
@@ -403,6 +403,9 @@ __bro_val_get_data(BroVal *val, int *type, void **data)
   if (! val || ! data)
     return FALSE;
 
+  if (val->val_type == NULL)
+    return FALSE;
+  
   if (! val->get_data)
     return FALSE;
Note: See TracTickets for help on using tickets.