From 959516d61bc6ee7cdd12409dde0ec00044208f1b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 29 Mar 2012 17:13:07 -0700 Subject: More strlcat/strlcpy truncate checks. --- source3/libads/ads_struct.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source3/libads') diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index b6c8e995ed..e6220fd320 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -52,10 +52,17 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int return NULL; } - strlcpy(ret,field, len); + if (strlcpy(ret,field, len) >= len) { + /* Truncate ! */ + free(r); + return NULL; + } p=strtok_r(r, sep, &saveptr); if (p) { - strlcat(ret, p, len); + if (strlcat(ret, p, len) >= len) { + free(r); + return NULL; + } while ((p=strtok_r(NULL, sep, &saveptr)) != NULL) { int retval; -- cgit