[PATCH:libXt 4/5] makestrs: Replace strcpy()+strcat() calls with snprintf() calls

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 19 10:41:18 PST 2015


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 util/makestrs.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/util/makestrs.c b/util/makestrs.c
index 7853f87..f872ec8 100644
--- a/util/makestrs.c
+++ b/util/makestrs.c
@@ -102,9 +102,7 @@ static FILE *ifopen(const char *file, const char *mode)
     if (buffer == NULL)
         return NULL;
 
-    strcpy(buffer, includedir);
-    strcat(buffer, "/");
-    strcat(buffer, file);
+    snprintf(buffer, len + 1, "%s/%s", includedir, file);
 
     ret = fopen(buffer, mode);
 
@@ -580,8 +578,7 @@ static void DoLine(char *buf)
 	    else
 		right = buf + 1;
 	    if (buf[0] == 'H') {
-		strcpy (lbuf, prefixstr);
-		strcat (lbuf, right);
+		snprintf (lbuf, sizeof(lbuf), "%s%s", prefixstr, right);
 		right = lbuf;
 	    }
 
-- 
1.7.9.2



More information about the xorg-devel mailing list