changeset 13:5971a90f2459

Fix some gcc warnings
author AngelCarpintero
date Tue, 20 Jan 2009 12:23:52 +0000
parents bc21025dcf6d
children 647e63ddab46
files example/dummy.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/example/dummy.c	Tue Jan 20 12:19:45 2009 +0000
+++ b/example/dummy.c	Tue Jan 20 12:23:52 2009 +0000
@@ -321,7 +321,7 @@
 				ostatus = strtok(NULL, "\t");
 				
                 if (istatus[0] == '-') {
-					sprintf(pipepath, "/dev/%s", input);
+					snprintf(pipepath, 255, "/dev/%s", input);
 					pipe_fd = open(pipepath, O_RDWR);
 
 					if (pipe_fd >= 0) {
@@ -349,9 +349,9 @@
 
 		while ((dirp = readdir(dir)) != NULL) {
             if (!strncmp(dirp->d_name, "video", 5)) {
-                strcpy(buffer, prefix);
-                strcat(buffer, dirp->d_name);
-                strcat(buffer, "/name");
+                strncpy(buffer, prefix, 255 - strlen(prefix));
+                strncat(buffer, dirp->d_name, 255 - strlen(buffer));
+                strncat(buffer, "/name", 255 - strlen(buffer));
                 
                 if ((fd = open(buffer, O_RDONLY)) >= 0) {
                     if ((read(fd, buffer, sizeof(buffer)-1)) < 0) {