summaryrefslogtreecommitdiffstats
path: root/contrib/subversion/subversion/libsvn_subr/sysinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/subversion/subversion/libsvn_subr/sysinfo.c')
-rw-r--r--contrib/subversion/subversion/libsvn_subr/sysinfo.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/subversion/subversion/libsvn_subr/sysinfo.c b/contrib/subversion/subversion/libsvn_subr/sysinfo.c
index 7c37822..a506310 100644
--- a/contrib/subversion/subversion/libsvn_subr/sysinfo.c
+++ b/contrib/subversion/subversion/libsvn_subr/sysinfo.c
@@ -290,11 +290,21 @@ stringbuf_split_key(svn_stringbuf_t *buffer, char delim)
return NULL;
svn_stringbuf_strip_whitespace(buffer);
+
+ /* Now we split the currently allocated buffer in two parts:
+ - a const char * HEAD
+ - the remaining stringbuf_t. */
+
+ /* Create HEAD as '\0' terminated const char * */
key = buffer->data;
end = strchr(key, delim);
*end = '\0';
- buffer->len = 1 + end - key;
+
+ /* And update the TAIL to be a smaller, but still valid stringbuf */
buffer->data = end + 1;
+ buffer->len -= 1 + end - key;
+ buffer->blocksize -= 1 + end - key;
+
svn_stringbuf_strip_whitespace(buffer);
return key;
OpenPOWER on IntegriCloud