]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode mime: fix scan-build issues
authorVictor Julien <victor@inliniac.net>
Sat, 25 Oct 2014 14:16:54 +0000 (16:16 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 30 Oct 2014 12:33:54 +0000 (13:33 +0100)
src/mime-decode.c

index a34d6a7142d0bee824c086f9fa3aec7be64c1a31..f2f9d24a500988e92104c5e27479928105c3a241 100644 (file)
@@ -299,17 +299,14 @@ MimeDecField * MimeDecAddField(MimeDecEntity *entity) {
     }
     memset(node, 0x00, sizeof(MimeDecField));
 
-    if (entity != NULL) {
-
-        /* If list is empty, then set as head of list */
-        if (entity->field_list == NULL) {
-            entity->field_list = node;
-        } else {
-            /* Otherwise add to beginning of list since these are out-of-order in
-             * the message */
-            node->next = entity->field_list;
-            entity->field_list = node;
-        }
+    /* If list is empty, then set as head of list */
+    if (entity->field_list == NULL) {
+        entity->field_list = node;
+    } else {
+        /* Otherwise add to beginning of list since these are out-of-order in
+         * the message */
+        node->next = entity->field_list;
+        entity->field_list = node;
     }
 
     return node;
@@ -692,6 +689,9 @@ static uint8_t * GetLine(uint8_t *buf, uint32_t blen, uint8_t **remainPtr,
     } else {
         *remainPtr = buf;
     }
+    if (buf == NULL)
+        return NULL;
+
     tok = buf;
 
     /* length must be specified */
@@ -744,6 +744,8 @@ static uint8_t * GetToken(uint8_t *buf, uint32_t blen, const char *delims,
     } else {
         *remainPtr = buf;
     }
+    if (buf == NULL)
+        return NULL;
 
     /* Must specify length */
     for (i = 0; i < blen && buf[i] != 0; i++) {