add some consistency checks

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11147 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2002-08-20 09:46:20 +00:00
parent 75c2c8ea52
commit 4dabe9d15e

View File

@@ -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). * (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved. * All rights reserved.
* *
@@ -45,6 +45,12 @@ strlcat (char *dst, const char *src, size_t dst_sz)
{ {
size_t len = strlen(dst); 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); return len + strlcpy (dst + len, src, dst_sz - len);
} }
#endif #endif