summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/replace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index cd48b8d160..fe1cfc04eb 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -65,6 +65,9 @@ ftruncate for operating systems that don't have it
size_t len2 = strlen(s);
size_t ret = len1 + len2;
+ if (len1 >= bufsize) {
+ return 0;
+ }
if (len1+len2 >= bufsize) {
len2 = bufsize - (len1+1);
}