diff options
author | FichteFoll <fichtefoll2@googlemail.com> | 2019-09-09 23:51:41 +0200 |
---|---|---|
committer | Michael Homer <mwh@ecs.vuw.ac.nz> | 2019-11-02 12:58:18 +1300 |
commit | 089689d3ace0fc71d9afc74f4b57cdd3a3743986 (patch) | |
tree | 9bf26606e23822c391cc47f48240e77f7ad25b42 | |
parent | Increment version to 1.1.0 (diff) | |
download | dragon-089689d3ace0fc71d9afc74f4b57cdd3a3743986.tar.gz dragon-089689d3ace0fc71d9afc74f4b57cdd3a3743986.tar.bz2 dragon-089689d3ace0fc71d9afc74f4b57cdd3a3743986.zip |
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".
-rw-r--r-- | dragon.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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; } |