Commit 0f90a538 authored by Antonin Décimo's avatar Antonin Décimo Committed by Juliusz Chroboczek

Don't do pointer arithmetic on void*.

Reported by cppcheck.

(portability) '(void*)((char*)current_attribute)' is of type
'void *'. When using void pointers in calculations, the behaviour is
undefined.
parent 62186a37
...@@ -1590,7 +1590,7 @@ add_rule(int prio, const unsigned char *src_prefix, int src_plen, int table) ...@@ -1590,7 +1590,7 @@ add_rule(int prio, const unsigned char *src_prefix, int src_plen, int table)
message_header->nlmsg_len += current_attribute->rta_len; message_header->nlmsg_len += current_attribute->rta_len;
current_attribute = (void*) current_attribute = (void*)
((char*)current_attribute) + current_attribute->rta_len; ((char*)current_attribute + current_attribute->rta_len);
/* src */ /* src */
current_attribute->rta_len = RTA_LENGTH(addr_size); current_attribute->rta_len = RTA_LENGTH(addr_size);
...@@ -1599,7 +1599,7 @@ add_rule(int prio, const unsigned char *src_prefix, int src_plen, int table) ...@@ -1599,7 +1599,7 @@ add_rule(int prio, const unsigned char *src_prefix, int src_plen, int table)
message_header->nlmsg_len += current_attribute->rta_len; message_header->nlmsg_len += current_attribute->rta_len;
current_attribute = (void*) current_attribute = (void*)
((char*)current_attribute) + current_attribute->rta_len; ((char*)current_attribute + current_attribute->rta_len);
/* send message */ /* send message */
if(message_header->nlmsg_len > 64) { if(message_header->nlmsg_len > 64) {
...@@ -1652,7 +1652,7 @@ flush_rule(int prio, int family) ...@@ -1652,7 +1652,7 @@ flush_rule(int prio, int family)
message_header->nlmsg_len += current_attribute->rta_len; message_header->nlmsg_len += current_attribute->rta_len;
current_attribute = (void*) current_attribute = (void*)
((char*)current_attribute) + current_attribute->rta_len; ((char*)current_attribute + current_attribute->rta_len);
/* send message */ /* send message */
if(message_header->nlmsg_len > 64) { if(message_header->nlmsg_len > 64) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment