Ticket #8 (accepted Task)
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: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.