Fixed Array index -1 is out of bounds issue 84/204584/1
authorNishant Chaprana <n.chaprana@samsung.com>
Wed, 24 Apr 2019 14:29:27 +0000 (19:59 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Wed, 24 Apr 2019 14:29:27 +0000 (19:59 +0530)
Change-Id: I6f1fa2789b42be00acddc30524cb78cfafece6e9
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
packaging/inm-manager.spec
test/inm-test.c

index e448427d8397823d9951b630fecc588d4bc45ffc..c5511797fdf3d01f8977f19a5d90cfafd2fe75bf 100644 (file)
@@ -1,6 +1,6 @@
 Name:       inm-manager
 Summary:    INM(Intelligent Network Monitoring) daemon
-Version:    0.0.23
+Version:    0.0.24
 Release:    1
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 3f0429a9034691beda7692728534d1addf723026..0b3dd6368a257861d3bbdf8e5488618b6302b061 100644 (file)
@@ -2230,16 +2230,16 @@ static gboolean test_terminal_read_std_input(GIOChannel * source,
 
        errno = 0;
        n = read(fd, buf, 1024);
-
-       buf[n - 1] = '\0'; /* remove new line... */
-       if (n == 0)
+       if (n == 0) {
                printf("Error: read() from stdin returns 0.\n");
-       else if (n < 0)
+       } else if (n < 0) {
                printf("input: read, err\n");
-       else
+       } else {
+               buf[n - 1] = '\0'; /* remove new line... */
                printf("\n\n");
+               process_input(buf, user_data);
+       }
 
-       process_input(buf, user_data);
 
        return TRUE;
 }