From 089689d3ace0fc71d9afc74f4b57cdd3a3743986 Mon Sep 17 00:00:00 2001 From: FichteFoll Date: Mon, 9 Sep 2019 23:51:41 +0200 Subject: Prevent memory corruption by checking MAX_SIZE This isn't exactly a "fix" but more like a "don't do anything stupid beyond this point". --- dragon.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dragon.c b/dragon.c index 112a08d..fca077c 100644 --- a/dragon.c +++ b/dragon.c @@ -131,8 +131,13 @@ GtkButton *add_button(char *label, struct draggable_thing *dragdata, int type) { gtk_container_add(GTK_CONTAINER(vbox), button); - if(drag_all) - uri_collection[uri_count++] = dragdata->uri; + if (drag_all) { + if (uri_count < MAX_SIZE) { + uri_collection[uri_count++] = dragdata->uri; + } else { + fprintf(stderr, "Exceeded maximum number of files for drag_all (%d)\n", MAX_SIZE); + } + } return (GtkButton *)button; } -- cgit