Commit 8118e273 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Protect the event for over-reading

parent 8af08ad0
Pipeline #174815 passed with stages
in 31 minutes
...@@ -413,6 +413,10 @@ event_get_data (const TarotGameEvent * event, size_t *n, size_t start, ...@@ -413,6 +413,10 @@ event_get_data (const TarotGameEvent * event, size_t *n, size_t start,
size_t max, TarotCard * cards) size_t max, TarotCard * cards)
{ {
*n = event->n; *n = event->n;
if (max > event->n)
{
max = event->n;
}
memcpy (cards, event->data + start, max * sizeof (*cards)); memcpy (cards, event->data + start, max * sizeof (*cards));
} }
......
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