From: Victor Julien Date: Sat, 25 Oct 2014 14:16:54 +0000 (+0200) Subject: decode mime: fix scan-build issues X-Git-Tag: suricata-2.1beta2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd4b506cc28aeb893c76acbda43019d039a59e59;p=thirdparty%2Fsuricata.git decode mime: fix scan-build issues --- diff --git a/src/mime-decode.c b/src/mime-decode.c index a34d6a7142..f2f9d24a50 100644 --- a/src/mime-decode.c +++ b/src/mime-decode.c @@ -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++) {