Project

General

Profile

Actions

Bug #7194

closed

output: jb context not closed on error in EvePacket

Added by Jeff Lucovsky 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

An error can leave an unclosed json-builder object unclosed:

void EvePacket(const Packet *p, JsonBuilder *js, unsigned long max_length)
{
    unsigned long max_len = max_length == 0 ? GET_PKT_LEN(p) : max_length;
    jb_set_base64(js, "packet", GET_PKT_DATA(p), max_len);

    if (!jb_open_object(js, "packet_info")) {
        return;
    }
    if (!jb_set_uint(js, "linktype", p->datalink)) {
        return;
    }
    jb_close(js);
}

If jb_set_uint were to fail, the object remains unclosed.

Actions

Also available in: Atom PDF