Check overflow
authorCheoleun Moon <chleun.moon@samsung.com>
Thu, 2 Apr 2020 06:53:13 +0000 (15:53 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Thu, 2 Apr 2020 06:53:13 +0000 (15:53 +0900)
test/wifi-aware-publish-test.c
test/wifi-aware-subscribe-test.c
test/wifi-aware-test.c

index f66aa2564d73269b3964cc2a976057c2e50f2c32..5dc3658ebad84ff5ebe25455a1456d552de57e37 100644 (file)
@@ -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);
index aec6ebfd89907e34d43ad4af373d16d415192a55..df25e4c539e6c9a25a641f3858418d7d10eaab85 100644 (file)
@@ -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);
index 4dc5ab1799c1fc1ea1ab8bb1d98487b609a0e6a5..1f911ae83023b644fbe538a3a7cc8471f0842613 100644 (file)
@@ -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);