From 5b9633e40d3230ff6e0e64879eefddfe7e9e8516 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 22 Aug 2006 23:12:22 +0000 Subject: r17724: don't rely on strnlen() as MacOSX 10.4 doesn't have it. Someday apple will realise that buffer overflows are bad .... (This used to be commit 0a6968b71b3cc492edfc3d46bd7e0c66c7ed8557) --- source4/lib/ldb/ldb_tdb/ldb_pack.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb') diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c index c6edf663ae..b2a004b99f 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_pack.c +++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c @@ -155,6 +155,16 @@ int ltdb_pack_data(struct ldb_module *module, return 0; } +/* using this means we can compile standalone on broken systems like + MacOSX 10.4 */ +static size_t ldb_strnlen(const char *s, size_t n) +{ + int i; + for (i=0; s[i] && i