From 8d644ad0cb7aec40b3f79119e3d0f29b6e347fff Mon Sep 17 00:00:00 2001 From: "Sungjun, Lee" Date: Thu, 12 May 2016 14:17:32 +0900 Subject: [PATCH] Fix the width limitation of scanf function Change-Id: Ie08ef6d69546a88ce598d01324b186ce82f5f971 Signed-off-by: Sungjun, Lee --- tools/dpm-cli-toolkit/dpm-cli-toolkit.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/dpm-cli-toolkit/dpm-cli-toolkit.c b/tools/dpm-cli-toolkit/dpm-cli-toolkit.c index 729a6ca..3f22667 100644 --- a/tools/dpm-cli-toolkit/dpm-cli-toolkit.c +++ b/tools/dpm-cli-toolkit/dpm-cli-toolkit.c @@ -81,7 +81,7 @@ void password_policy_handler(void) int input_status = 0; int ret = -1; int value = 0; - char pattern[200], new_password[200]; + char pattern[100], new_password[100]; char *get_pattern = NULL; print_menu(DPM_PASSWORD); @@ -153,7 +153,7 @@ void password_policy_handler(void) break; case 7: printf("pattern> "); - if (scanf("%s", pattern) < 0) { + if (scanf("%100s", pattern) < 0) { input_status = -1; goto out; } @@ -161,7 +161,7 @@ void password_policy_handler(void) break; case 8: printf("new password> "); - if (scanf("%s", new_password) < 0) { + if (scanf("%100s", new_password) < 0) { input_status = -1; goto out; } @@ -313,7 +313,7 @@ void zone_policy_handler(void) int channel; int input_status = 0; int ret = -1; - char name[200]; + char name[100]; print_menu(DPM_ZONE); if (scanf("%d", &channel) < 0) { @@ -324,7 +324,7 @@ void zone_policy_handler(void) switch (channel) { case 1: printf("zone name> "); - if (scanf("%s", name) < 0) { + if (scanf("%100s", name) < 0) { input_status = -1; goto out; } @@ -332,7 +332,7 @@ void zone_policy_handler(void) break; case 2: printf("zone name> "); - if (scanf("%s", name) < 0) { + if (scanf("%100s", name) < 0) { input_status = -1; goto out; } @@ -363,7 +363,7 @@ void bluetooth_policy_handler(void) int channel; int input_status = 0; int ret = -1, enable = 0; - char mac_address[200], uuid[200]; + char mac_address[100], uuid[100]; print_menu(DPM_BLUETOOTH); if (scanf("%d", &channel) < 0) { @@ -374,7 +374,7 @@ void bluetooth_policy_handler(void) switch (channel) { case 1: printf("mac address> "); - if (scanf("%s", mac_address) < 0) { + if (scanf("%100s", mac_address) < 0) { input_status = -1; goto out; } @@ -382,7 +382,7 @@ void bluetooth_policy_handler(void) break; case 2: printf("mac address> "); - if (scanf("%s", mac_address) < 0) { + if (scanf("%100s", mac_address) < 0) { input_status = -1; goto out; } @@ -411,7 +411,7 @@ void bluetooth_policy_handler(void) break; case 5: printf("uuid> "); - if (scanf("%s", uuid) < 0) { + if (scanf("%100s", uuid) < 0) { input_status = -1; goto out; } @@ -419,7 +419,7 @@ void bluetooth_policy_handler(void) break; case 6: printf("uuid> "); - if (scanf("%s", uuid) < 0) { + if (scanf("%100s", uuid) < 0) { input_status = -1; goto out; } -- 2.7.4