lq: make sure that info_head != NULL
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 23 Oct 2012 12:42:32 +0000 (14:42 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 23 Oct 2012 12:49:41 +0000 (14:49 +0200)
Coverity:
CID 739652 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
At (88): Dereferencing null pointer "info_head".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/lq_packet.c

index 34606f9..efb5018 100644 (file)
@@ -41,6 +41,8 @@
  *
  */
 
+#include <assert.h>
+
 #include "ipcalc.h"
 #include "olsr_protocol.h"
 #include "defs.h"
@@ -424,6 +426,7 @@ serialize_lq_hello(struct lq_hello_message *lq_hello, struct interface *outif)
 
           // finalize the info header
 
+          assert(info_head);
           info_head->size = ntohs(buff + size - (unsigned char *)info_head);
 
           // output packet