]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
json-file: check pointer before using
authorVictor Julien <victor@inliniac.net>
Tue, 22 Apr 2014 15:45:45 +0000 (17:45 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 23 Apr 2014 06:36:14 +0000 (08:36 +0200)
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
src/output-json-file.c

index e4c07c599a410548837fb301e3d20bde14ed13cc..db46e23b5775524f5222b5dfef237ab703cafc56 100644 (file)
@@ -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);