summaryrefslogtreecommitdiff
path: root/src/tools/irm/irm_ipcp_bootstrap.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2018-09-27 11:36:42 +0200
committerDimitri Staessens <[email protected]>2018-09-27 13:59:29 +0200
commitc166a030a1be0e4006605dd12190741986e0f9f2 (patch)
tree35402df575984b3e9d78d28d2f09b3db75b5675b /src/tools/irm/irm_ipcp_bootstrap.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 <[email protected]> Signed-off-by: Dimitri Staessens <[email protected]>
Diffstat (limited to 'src/tools/irm/irm_ipcp_bootstrap.c')
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index e1f75956..3d9386ad 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -287,10 +287,15 @@ int do_bootstrap_ipcp(int argc,
if (autobind && conf.type != IPCP_NORMAL) {
printf("Can only bind normal IPCPs, "
- "autobind disabled.\n");
+ "autobind disabled.\n\n");
autobind = false;
}
+ if (strlen(layer) > LAYER_NAME_SIZE) {
+ printf("Layer name too big.\n\n");
+ goto fail_usage;
+ }
+
strcpy(conf.layer_info.layer_name, layer);
if (conf.type != IPCP_UDP)
conf.layer_info.dir_hash_algo = hash_algo;