From: Cheoleun Moon Date: Thu, 2 Apr 2020 06:53:13 +0000 (+0900) Subject: Check overflow X-Git-Tag: submit/tizen/20200403.050222~2^2~7^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5eefb9846d51d1628a1f131bc7d0dec7db742250;p=platform%2Fcore%2Fapi%2Fwifi-aware.git Check overflow --- diff --git a/test/wifi-aware-publish-test.c b/test/wifi-aware-publish-test.c index f66aa25..5dc3658 100644 --- a/test/wifi-aware-publish-test.c +++ b/test/wifi-aware-publish-test.c @@ -591,7 +591,7 @@ static gboolean __test_terminal_read_std_input(GIOChannel * source, printf("Error: read() from stdin returns 0.\n"); } else if (n < 0) { printf("input: read, err\n"); - } else if (n < 1024) { + } else if (n - 1 > 0 && n < 1024) { buf[n - 1] = '\0'; /* remove new line... */ printf("\n\n"); __process_input(buf, user_data); diff --git a/test/wifi-aware-subscribe-test.c b/test/wifi-aware-subscribe-test.c index aec6ebf..df25e4c 100644 --- a/test/wifi-aware-subscribe-test.c +++ b/test/wifi-aware-subscribe-test.c @@ -636,7 +636,7 @@ static gboolean __test_terminal_read_std_input(GIOChannel * source, printf("Error: read() from stdin returns 0.\n"); } else if (n < 0) { printf("input: read, err\n"); - } else if (n < 1024) { + } else if (n - 1 > 0 && n < 1024) { buf[n - 1] = '\0'; /* remove new line... */ printf("\n\n"); __process_input(buf, user_data); diff --git a/test/wifi-aware-test.c b/test/wifi-aware-test.c index 4dc5ab1..1f911ae 100644 --- a/test/wifi-aware-test.c +++ b/test/wifi-aware-test.c @@ -1042,7 +1042,7 @@ static gboolean __test_terminal_read_std_input(GIOChannel * source, printf("Error: read() from stdin returns 0.\n"); } else if (n < 0) { printf("input: read, err\n"); - } else if (n < 1024) { + } else if (n - 1 > 0 && n < 1024) { buf[n - 1] = '\0'; /* remove new line... */ printf("\n\n"); __process_input(buf, user_data);