summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2003-03-19 20:50:56 +0000
committerJim McDonough <jmcd@samba.org>2003-03-19 20:50:56 +0000
commit6c6fb121cd36c4aaeacca295fde744617e3fa61e (patch)
tree80969dbcd708dcbad02ff97d127f7d2ff8440dfe /source3/lib
parentcbded5d6f889542f803932b280e0de826238fce7 (diff)
downloadsamba-6c6fb121cd36c4aaeacca295fde744617e3fa61e.tar.gz
samba-6c6fb121cd36c4aaeacca295fde744617e3fa61e.tar.bz2
samba-6c6fb121cd36c4aaeacca295fde744617e3fa61e.zip
use strnlen to prevent coredumps
(This used to be commit 5078436d83f0fdc568d6687809c7c70dea5fd382)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_str.c6
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);