PUD: add an assert
authorFerry Huberts <f.huberts@mindef.nl>
Thu, 4 Aug 2011 12:39:13 +0000 (14:39 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Thu, 18 Aug 2011 13:27:30 +0000 (15:27 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/nodeIdConversion.c
lib/pud/src/receiver.c

index 4143a1e..539af3d 100644 (file)
@@ -208,7 +208,11 @@ void getNodeIdStringFromOlsr(int ipVersion, union olsr_message *olsrMessage,
                switch (olsrGpsMessage->nodeInfo.nodeIdType) {
                        case PUD_NODEIDTYPE_MAC: /* hardware address */
                        {
-                               int chars = snprintf(nodeIdBuffer, nodeIdBufferSize,
+                               int chars;
+
+                               assert (bufferSize == 6);
+
+                               chars = snprintf(nodeIdBuffer, nodeIdBufferSize,
                                                "%02x:%02x:%02x:%02x:%02x:%02x", buffer[0], buffer[1],
                                                buffer[2], buffer[3], buffer[4], buffer[5]);
                                if (likely(chars < (int) nodeIdBufferSize)) {
index eedefde..bfc1381 100644 (file)
@@ -24,6 +24,7 @@
 #include <nmea/sentence.h>
 #include <math.h>
 #include <net/if.h>
+#include <assert.h>
 
 /* Debug includes */
 #if defined(PUD_DUMP_GPS_PACKETS_TX_OLSR) || \