aboutsummaryrefslogtreecommitdiff
path: root/dragon.c
diff options
context:
space:
mode:
authorFichteFoll <fichtefoll2@googlemail.com>2019-09-09 23:53:10 +0200
committerMichael Homer <mwh@ecs.vuw.ac.nz>2019-11-02 12:58:18 +1300
commit363bc123d077d764cb73556e95b05d8fe1a8b1f8 (patch)
tree4e9c8eff7c2b24ad43f04a16c1f5613c8570dfb8 /dragon.c
parentPrevent memory corruption by checking MAX_SIZE (diff)
downloaddragon-363bc123d077d764cb73556e95b05d8fe1a8b1f8.tar.gz
dragon-363bc123d077d764cb73556e95b05d8fe1a8b1f8.tar.bz2
dragon-363bc123d077d764cb73556e95b05d8fe1a8b1f8.zip
uri_collection needs to hold one more item than max
Because the last item needs to be NULL and is written in `drag_data_get`.
Diffstat (limited to 'dragon.c')
-rw-r--r--dragon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dragon.c b/dragon.c
index fca077c..debe087 100644
--- a/dragon.c
+++ b/dragon.c
@@ -393,8 +393,8 @@ int main (int argc, char **argv) {
exit(0);
}
- if(drag_all){
- uri_collection = malloc(sizeof(char*) * (argc > MAX_SIZE? argc: MAX_SIZE));
+ if (drag_all) {
+ uri_collection = malloc(sizeof(char*) * ((argc > MAX_SIZE ? argc : MAX_SIZE) + 1));
uri_count = 0;
}
bgstack15