Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 31 Aug 2001 01:46:47 +0000 (01:46 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 31 Aug 2001 01:46:47 +0000 (01:46 +0000)
* crypt/md5-crypt.c (__md5_crypt_r): Compute used and required
memory correctly.

ChangeLog
crypt/md5-crypt.c

index 65071a4ab5cf18a4991f46e8ebb2c52795c90a58..c22649af2e4d06c269bcaf08e301e2f7590ff84d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2001-08-30  Ulrich Drepper  <drepper@redhat.com>
 
+       * crypt/md5-crypt.c (__md5_crypt_r): Compute used and required
+       memory correctly.
+
        * sysdeps/unix/sysv/linux/ia64/ioperm.c (_ioperm): Use __open
        instead of open, __close instead of close, __getpagesize instead
        of getpagesize.
index 7119d7faf5928fc791c97c04aa9dc5d4e86ab619..018b2df4377838b67f5e0e240c8b653210a08f0a 100644 (file)
@@ -1,5 +1,5 @@
 /* One way encryption based on MD5 sum.
-   Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -179,10 +179,10 @@ __md5_crypt_r (key, salt, buffer, buflen)
   /* Now we can construct the result string.  It consists of three
      parts.  */
   cp = __stpncpy (buffer, md5_salt_prefix, MAX (0, buflen));
-  buflen -= sizeof (md5_salt_prefix);
+  buflen -= sizeof (md5_salt_prefix) - 1;
 
-  cp = __stpncpy (cp, salt, MIN ((size_t) buflen, salt_len));
-  buflen -= MIN ((size_t) buflen, salt_len);
+  cp = __stpncpy (cp, salt, MIN ((size_t) MAX (0, buflen), salt_len));
+  buflen -= MIN ((size_t) MAX (0, buflen), salt_len);
 
   if (buflen > 0)
     {