secure: can only work for IPv4, so assert on it
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 23 Oct 2012 07:43:25 +0000 (09:43 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 23 Oct 2012 08:52:47 +0000 (10:52 +0200)
Because of:
  memcpy(&rrmsg.destination, to, olsr_cnf->ipsize);
with
  rrmsg.destination being an uint32_t

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

index fdaf1e1..e7773eb 100644 (file)
@@ -53,6 +53,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <signal.h>
+#include <assert.h>
 
 #include "defs.h"
 #include "ipcalc.h"
@@ -985,6 +986,7 @@ send_rres(struct interface *olsr_if, union olsr_ip_addr *to, union olsr_ip_addr
   olsr_printf(3, "[ENC]Timestamp %lld\n", (long long)now.tv_sec);
 #endif /* _WIN32 */
   /* Fill subheader */
+  assert(olsr_cnf->ipsize == sizeof(rrmsg.destination));
   memcpy(&rrmsg.destination, to, olsr_cnf->ipsize);
 
   /* Create digest of received challenge + IP */