aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-06-28 22:28:47 +0200
committercbdev <cb@cbcdn.com>2021-06-28 22:28:47 +0200
commit17551fe56c8dc20630811b1726559b00cb911abd (patch)
tree076b024288e7b35d71cd5c76b3d23a1eb8489f15 /backends
parent9be900acd86e03c73266c552db133562005f5607 (diff)
downloadmidimonster-17551fe56c8dc20630811b1726559b00cb911abd.tar.gz
midimonster-17551fe56c8dc20630811b1726559b00cb911abd.tar.bz2
midimonster-17551fe56c8dc20630811b1726559b00cb911abd.zip
Fix Coverity CIDs 371602, 355843
Diffstat (limited to 'backends')
-rw-r--r--backends/mqtt.c2
-rw-r--r--backends/rtpmidi.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/backends/mqtt.c b/backends/mqtt.c
index 47042f1..da4bf38 100644
--- a/backends/mqtt.c
+++ b/backends/mqtt.c
@@ -765,7 +765,7 @@ static int mqtt_handle_publish(instance* inst, uint8_t type, uint8_t* variable_h
uint16_t topic_alias = 0;
uint32_t property_length = 0;
size_t u = data->nchannels, property_offset, payload_offset, payload_length;
- size_t topic_length = mqtt_pop_utf8(variable_header, length, &topic);
+ size_t topic_length = min(mqtt_pop_utf8(variable_header, length, &topic), length);
property_offset = payload_offset = topic_length + 2 + ((qos > 0) ? 2 : 0);
if(data->mqtt_version == 0x05){
diff --git a/backends/rtpmidi.c b/backends/rtpmidi.c
index 922075e..d349e6f 100644
--- a/backends/rtpmidi.c
+++ b/backends/rtpmidi.c
@@ -1299,8 +1299,10 @@ static int rtpmidi_mdns_broadcast(uint8_t* frame, size_t len){
};
//send to ipv4 and ipv6 mcasts
- sendto(cfg.mdns_fd, frame, len, 0, (struct sockaddr*) &mcast6, sizeof(mcast6));
- sendto(cfg.mdns4_fd, frame, len, 0, (struct sockaddr*) &mcast, sizeof(mcast));
+ if((sendto(cfg.mdns_fd, frame, len, 0, (struct sockaddr*) &mcast6, sizeof(mcast6)) != len)
+ | (sendto(cfg.mdns4_fd, frame, len, 0, (struct sockaddr*) &mcast, sizeof(mcast)) != len)){
+ LOG("Failed to transmit mDNS frame");
+ }
return 0;
}