aboutsummaryrefslogtreecommitdiff
path: root/crypt/md5-crypt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-31 01:46:47 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-31 01:46:47 +0000
commitcb2391e14af26237a71729d7af2d9202fc22f12c (patch)
treeed879108944eef1a38bd13b70e85df7a7fc467a8 /crypt/md5-crypt.c
parent90d40ab5d4d4acd924efa49d577467947bdf95e5 (diff)
downloadglibc-cb2391e14af26237a71729d7af2d9202fc22f12c.zip
glibc-cb2391e14af26237a71729d7af2d9202fc22f12c.tar.gz
glibc-cb2391e14af26237a71729d7af2d9202fc22f12c.tar.bz2
Update.
* crypt/md5-crypt.c (__md5_crypt_r): Compute used and required memory correctly.
Diffstat (limited to 'crypt/md5-crypt.c')
-rw-r--r--crypt/md5-crypt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypt/md5-crypt.c b/crypt/md5-crypt.c
index 7119d7f..018b2df 100644
--- a/crypt/md5-crypt.c
+++ b/crypt/md5-crypt.c
@@ -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)
{