diff options
Diffstat (limited to 'crypto/heimdal/lib/roken/strlcat.c')
-rw-r--r-- | crypto/heimdal/lib/roken/strlcat.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/heimdal/lib/roken/strlcat.c b/crypto/heimdal/lib/roken/strlcat.c index d3c8baa..1366e88 100644 --- a/crypto/heimdal/lib/roken/strlcat.c +++ b/crypto/heimdal/lib/roken/strlcat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1995-2002 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -36,7 +36,7 @@ #endif #include "roken.h" -RCSID("$Id: strlcat.c,v 1.5 1999/12/02 16:58:53 joda Exp $"); +RCSID("$Id: strlcat.c,v 1.6 2002/08/20 09:46:20 joda Exp $"); #ifndef HAVE_STRLCAT @@ -45,6 +45,12 @@ strlcat (char *dst, const char *src, size_t dst_sz) { size_t len = strlen(dst); + if (dst_sz < len) + /* the total size of dst is less than the string it contains; + this could be considered bad input, but we might as well + handle it */ + return len + strlen(src); + return len + strlcpy (dst + len, src, dst_sz - len); } #endif |