From 789780275c8408325143f68272088e702753424a Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 17 Feb 2003 23:33:55 +0000 Subject: Add comment explaining the -DDEVELOPER safe_strcpy overflow hack. (This used to be commit 90e1d8bdfa9ec0a4f3795d9a89db1d2324447b68) --- source3/lib/util_str.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/lib') diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index d4291082da..2beb67d825 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -443,7 +443,11 @@ char *safe_strcpy(char *dest,const char *src, size_t maxlength) } #ifdef DEVELOPER - dest[maxlength]='\0'; + /* We intentionally write out at the extremity of the destination + * string. If the destination is too short (e.g. pstrcpy into mallocd + * or fstring) then this should cause an error under a memory + * checker. */ + dest[maxlength] = '\0'; #endif if (!src) { -- cgit