damn strncpy function
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Mon, 29 Nov 2010 00:04:55 +0100
changeset 162 fad55be2d07c
parent 161 36f763c8ab16
child 163 780bf4f348f3
damn strncpy function 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
      */
-    strncpy (buffer, argv[1], sizeof (buffer));
-    strncpy (text, argv[1], sizeof (buffer));
+    strncpy (buffer, argv[1], sizeof (buffer) - 1);
+    strncpy (text, argv[1], sizeof (text) - 1);
 
     md5_hash = MD5 ((u_char *) buffer, strlen (buffer), NULL);