Commit 71e9a14a authored by Antonin Décimo's avatar Antonin Décimo Committed by Juliusz Chroboczek

Don't memcpy channels if length is 0.

parent 88e26d98
......@@ -1250,6 +1250,7 @@ really_buffer_update(struct buffered *buf, struct interface *ifp,
if(channels_size > 0) {
accumulate_byte(buf, 2);
accumulate_byte(buf, channels_len);
if(channels_len > 0)
accumulate_bytes(buf, channels, channels_len);
}
end_message(buf, MESSAGE_UPDATE, len);
......@@ -1425,9 +1426,9 @@ flushupdates(struct interface *ifp)
continue;
if(route_ifp->channel == IF_CHANNEL_NONINTERFERING) {
memcpy(channels, route->channels,
MIN(route->channels_len, MAX_CHANNEL_HOPS));
chlen = MIN(route->channels_len, MAX_CHANNEL_HOPS);
if(chlen > 0)
memcpy(channels, route->channels, chlen);
} else {
if(route_ifp->channel == IF_CHANNEL_UNKNOWN)
channels[0] = IF_CHANNEL_INTERFERING;
......
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