summaryrefslogtreecommitdiff
path: root/subversion/libsvn_subr/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/libsvn_subr/string.c')
-rw-r--r--subversion/libsvn_subr/string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/subversion/libsvn_subr/string.c b/subversion/libsvn_subr/string.c
index 29176d6d5dc5..43a1a4ec1802 100644
--- a/subversion/libsvn_subr/string.c
+++ b/subversion/libsvn_subr/string.c
@@ -677,7 +677,7 @@ svn_stringbuf_remove(svn_stringbuf_t *str,
{
if (pos > str->len)
pos = str->len;
- if (pos + count > str->len)
+ if (count > str->len - pos)
count = str->len - pos;
memmove(str->data + pos, str->data + pos + count, str->len - pos - count + 1);
@@ -705,7 +705,7 @@ svn_stringbuf_replace(svn_stringbuf_t *str,
if (pos > str->len)
pos = str->len;
- if (pos + old_count > str->len)
+ if (old_count > str->len - pos)
old_count = str->len - pos;
if (old_count < new_count)