blueooth: actually honour 'room' variable (llvm-clang-analyzer)

This commit is contained in:
Lennart Poettering 2009-09-08 23:48:12 +02:00
parent 382eced35d
commit 1380f18e52

View file

@ -221,9 +221,7 @@ static int service_recv(struct userdata *u, bt_audio_msg_header_t *msg, size_t r
pa_assert(u); pa_assert(u);
pa_assert(u->service_fd >= 0); pa_assert(u->service_fd >= 0);
pa_assert(msg); pa_assert(msg);
pa_assert(room >= sizeof(*msg));
if (room <= 0)
room = BT_SUGGESTED_BUFFER_SIZE;
pa_log_debug("Trying to receive message from audio service..."); pa_log_debug("Trying to receive message from audio service...");
@ -236,6 +234,11 @@ static int service_recv(struct userdata *u, bt_audio_msg_header_t *msg, size_t r
return -1; return -1;
} }
if (msg->length > room) {
pa_log_error("Not enough room.");
return -1;
}
/* Secondly, read the payload */ /* Secondly, read the payload */
if (msg->length > sizeof(*msg)) { if (msg->length > sizeof(*msg)) {