diff options
author | Jim McDonough <jmcd@samba.org> | 2003-03-19 20:50:43 +0000 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2003-03-19 20:50:43 +0000 |
commit | e542eedd18701fcc413e924b0a9787eec925dee6 (patch) | |
tree | dcb4654ec8015e15c43383ad540c6368e9161f77 | |
parent | a666912f7bcc9945c2eed29701cba90b7579796e (diff) | |
download | samba-e542eedd18701fcc413e924b0a9787eec925dee6.tar.gz samba-e542eedd18701fcc413e924b0a9787eec925dee6.tar.bz2 samba-e542eedd18701fcc413e924b0a9787eec925dee6.zip |
use strnlen to prevent coredumps
(This used to be commit 1960a650c1546323708ed6bea615dc7215a97b4f)
-rw-r--r-- | source3/lib/util_str.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 5157de0d91..d1e57ed5cf 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -495,7 +495,7 @@ char *safe_strcpy_fn(const char *fn, int line, char *dest,const char *src, size_ return dest; } - len = strlen(src); + len = strnlen(src, maxlength+1); if (len > maxlength) { DEBUG(0,("ERROR: string overflow by %u (%u - %u) in safe_strcpy [%.50s]\n", @@ -524,8 +524,8 @@ char *safe_strcat_fn(const char *fn, int line, char *dest, const char *src, size if (!src) return dest; - src_len = strlen(src); - dest_len = strlen(dest); + src_len = strnlen(src, maxlength + 1); + dest_len = strnlen(dest, maxlength + 1); clobber_region(fn, line, dest + dest_len, maxlength + 1 - dest_len); |