cookie: an array already is a pointer
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 26 Oct 2012 12:50:44 +0000 (14:50 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 26 Oct 2012 12:57:50 +0000 (14:57 +0200)
Coverity:
CID 739655 (#1 of 1): Dereference after null check (FORWARD_NULL)
At (8): Passing null pointer "&branding->cmb_sig" to function
        "memcpy(void * restrict, void const * restrict, size_t)", which
        dereferences it.

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

index 8dd81f7..1548db9 100644 (file)
@@ -253,7 +253,7 @@ olsr_cookie_malloc(struct olsr_cookie_info *ci)
    * When the block is freed to detect corruption.
    */
   branding = (struct olsr_cookie_mem_brand *)ARM_NOWARN_ALIGN(((unsigned char *)ptr + ci->ci_size));
-  memcpy(&branding->cmb_sig, "cookie", 6);
+  memcpy(&branding->cmb_sig[0], "cookie", 6);
   branding->cmb_id = ci->ci_id;
 
   /* Stats keeping */