From: Archie Pusaka <apusaka@xxxxxxxxxxxx> This patch fixes size comparison and variable misassignment. Reviewed-by: Alain Michaud <alainm@xxxxxxxxxxxx> Reviewed-by: Michael Sun <michaelfsun@xxxxxxxxxx> --- profiles/audio/avdtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index c7bf99f429..5d13104c10 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -1323,7 +1323,7 @@ static GSList *caps_to_list(uint8_t *data, size_t size, cap = (struct avdtp_service_capability *)data; - if (sizeof(*cap) + cap->length >= size) { + if (sizeof(*cap) + cap->length > size) { error("Invalid capability data in getcap resp"); break; } @@ -1345,7 +1345,7 @@ static GSList *caps_to_list(uint8_t *data, size_t size, switch (cap->category) { case AVDTP_MEDIA_CODEC: if (codec) - *codec = cap; + *codec = cpy; break; case AVDTP_DELAY_REPORTING: if (delay_reporting) -- 2.32.0.272.g935e593368-goog