From: Victor Julien Date: Tue, 22 Apr 2014 15:45:45 +0000 (+0200) Subject: json-file: check pointer before using X-Git-Tag: suricata-2.0.1rc1~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d25f12cda60ebaf8448f79ff94ee84c2969b329;p=thirdparty%2Fsuricata.git json-file: check pointer before using A check was missing to see if ht_ud was not null before using the pointer. This should be rare, but it can happen. Reported-by: Will Metcalf --- diff --git a/src/output-json-file.c b/src/output-json-file.c index e4c07c599a..db46e23b57 100644 --- a/src/output-json-file.c +++ b/src/output-json-file.c @@ -81,7 +81,7 @@ static json_t *LogFileMetaGetUri(const Packet *p, const File *ff) { htp_tx_t *tx = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, ff->txid); if (tx != NULL) { HtpTxUserData *tx_ud = htp_tx_get_user_data(tx); - if (tx_ud->request_uri_normalized != NULL) { + if (tx_ud != NULL && tx_ud->request_uri_normalized != NULL) { char *s = bstr_util_strdup_to_c(tx_ud->request_uri_normalized); if (s != NULL) { js = json_string(s);