summaryrefslogtreecommitdiff
path: root/source4/lib/talloc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-12 02:54:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:40 -0500
commit9add53863f4bfd870e8af102057a1084e9849d20 (patch)
tree72f2b3f20d40883809e81725c0d4df96585987e8 /source4/lib/talloc
parent3da16200e9582cf676ece75c19be41842282f0a0 (diff)
downloadsamba-9add53863f4bfd870e8af102057a1084e9849d20.tar.gz
samba-9add53863f4bfd870e8af102057a1084e9849d20.tar.bz2
samba-9add53863f4bfd870e8af102057a1084e9849d20.zip
r6741: prevent talloc_strndup() from reading one byte past the end of a buffer,
giving valgrind errors (This used to be commit 7af0c547e0c0da3bc78a1ee6c2ab29114d8625cc)
Diffstat (limited to 'source4/lib/talloc')
-rw-r--r--source4/lib/talloc/talloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index 3650ab7f51..46abd89bac 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -919,7 +919,7 @@ char *talloc_strndup(const void *t, const char *p, size_t n)
size_t len;
char *ret;
- for (len=0; p[len] && len<n; len++) ;
+ for (len=0; len<n && p[len]; len++) ;
ret = _talloc(t, len + 1);
if (!ret) { return NULL; }