sensord: change sprintf to snprintf 78/54878/1
authorkibak.yoon <kibak.yoon@samsung.com>
Fri, 18 Dec 2015 10:39:32 +0000 (19:39 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Fri, 18 Dec 2015 10:39:32 +0000 (19:39 +0900)
Change-Id: I2675f9d10a0e01ef334c68052e488fadec658a2d
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/shared/sensor_logs.cpp
test/src/fusion-data-collection.c
test/src/multi-process-performance-test.c

index 4be987f..6af6cc5 100644 (file)
@@ -143,7 +143,7 @@ bool get_proc_name(pid_t pid, char *process_name)
 {
        char buf[NAME_MAX];
 
-       if (sprintf(buf, "%d process", pid) < 1) {
+       if (snprintf(buf, sizeof(buf), "%d process", pid) < 1) {
                return false;
        }
 
index 86e9a0f..10c1091 100755 (executable)
@@ -95,7 +95,7 @@ int main(int argc, char **argv)
        char file_name[50];
 
        for (i = 0; i < MAXSIZE; i++) {
-               sprintf(file_name, "output_%d", sensors[i]);
+               snprintf(file_name, sizeof(file_name), "output_%d", sensors[i]);
                file_output[i] = fopen(file_name, "w+");
                sensor_t sensor = sensord_get_sensor(sensors[i]);
                handle[i] = sensord_connect(sensor);
index c3555e2..c9b02ec 100755 (executable)
@@ -107,7 +107,7 @@ int main(int argc, char** argv)
 
                for (j = 0; j < MAX; j++) {
                        char command[100];
-                       sprintf(command, "kill %d", pids[j]);
+                       snprintf(command, sizeof(command), "kill %d", pids[j]);
                        if (system(command) == -1)
                                return -1;
                }