summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/mount.cifs.c3
-rw-r--r--source3/lib/replace/replace.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index ea254b6047..72ef9febe0 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -115,6 +115,9 @@ size_t strlcat(char *d, const char *s, size_t bufsize)
size_t ret = len1 + len2;
if (len1+len2 >= bufsize) {
+ if (bufsize < (len1+1)) {
+ return ret;
+ }
len2 = bufsize - (len1+1);
}
if (len2 > 0) {
diff --git a/source3/lib/replace/replace.c b/source3/lib/replace/replace.c
index 2c3f14c2df..106c9dfe62 100644
--- a/source3/lib/replace/replace.c
+++ b/source3/lib/replace/replace.c
@@ -82,6 +82,9 @@ size_t rep_strlcat(char *d, const char *s, size_t bufsize)
size_t ret = len1 + len2;
if (len1+len2 >= bufsize) {
+ if (bufsize < (len1+1)) {
+ return ret;
+ }
len2 = bufsize - (len1+1);
}
if (len2 > 0) {