aboutsummaryrefslogtreecommitdiff
path: root/dragon.c
diff options
context:
space:
mode:
authorFichteFoll <fichtefoll2@googlemail.com>2019-09-09 23:51:41 +0200
committerMichael Homer <mwh@ecs.vuw.ac.nz>2019-11-02 12:58:18 +1300
commit089689d3ace0fc71d9afc74f4b57cdd3a3743986 (patch)
tree9bf26606e23822c391cc47f48240e77f7ad25b42 /dragon.c
parentIncrement version to 1.1.0 (diff)
downloaddragon-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".
Diffstat (limited to 'dragon.c')
-rw-r--r--dragon.c9
1 files 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;
}
bgstack15