safer strcpy
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sun, 24 Oct 2010 20:55:19 +0200
changeset 148 8a5cf98a00b6
parent 147 f9015072361f
child 149 5acf77b9b7a0
safer strcpy committer: Markus Bröker <mbroeker@largo.homelinux.org>
md5.c
--- a/md5.c
+++ b/md5.c
@@ -29,8 +29,8 @@
     /*
      * MD5 alters the input buffer
      */
-    strcpy (buffer, argv[1]);
-    strcpy (text, argv[1]);
+    strncpy (buffer, argv[1], sizeof (buffer));
+    strncpy (text, argv[1], sizeof (buffer));
 
     md5_hash = MD5 ((u_char *) buffer, strlen (buffer), NULL);