summaryrefslogtreecommitdiff
path: root/src/tools/irm/irm_unregister.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2018-09-27 11:36:42 +0200
committerDimitri Staessens <dimitri.staessens@ugent.be>2018-09-27 13:59:29 +0200
commitc166a030a1be0e4006605dd12190741986e0f9f2 (patch)
tree35402df575984b3e9d78d28d2f09b3db75b5675b /src/tools/irm/irm_unregister.c
parentaf6756b94bb8c78d2d09a28966427e68b95c5a93 (diff)
downloadouroboros-c166a030a1be0e4006605dd12190741986e0f9f2.tar.gz
ouroboros-c166a030a1be0e4006605dd12190741986e0f9f2.zip
tools: Fix memleaks and buffer overflows in irm tool
This fixes some memleaks and potential buffer overflows in the irm tool. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Diffstat (limited to 'src/tools/irm/irm_unregister.c')
-rw-r--r--src/tools/irm/irm_unregister.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tools/irm/irm_unregister.c b/src/tools/irm/irm_unregister.c
index 52491b42..137bc7e9 100644
--- a/src/tools/irm/irm_unregister.c
+++ b/src/tools/irm/irm_unregister.c
@@ -69,7 +69,7 @@ int do_unregister(int argc, char ** argv)
char * ipcp[MAX_IPCPS];
size_t ipcp_len = 0;
struct ipcp_info * ipcps;
- size_t len;
+ ssize_t len;
size_t i;
while (argc > 0) {
@@ -103,7 +103,10 @@ int do_unregister(int argc, char ** argv)
}
len = irm_list_ipcps(&ipcps);
- for (i = 0; i < len; ++i) {
+ if (len < 0)
+ return -1;
+
+ for (i = 0; i < (size_t) len; ++i) {
size_t j;
for (j = 0; j < layers_len; j++) {
if (wildcard_match(ipcps[i].layer, layers[j]) == 0) {