Skip to content

Commit 471de34

Browse files
committed
* The off by one was on the allocation, not on the write
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1927941 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5d2ccf8 commit 471de34

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

uri/apr_uri.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ static char * percent_encode_scope_zone_id(apr_pool_t *p, apr_uri_t const *uptr)
140140

141141
offset = s - uptr->hostname;
142142

143-
hostcopy = apr_palloc(p, len + 2);
143+
hostcopy = apr_palloc(p, len + 3);
144144
memcpy(hostcopy, uptr->hostname, offset + 1);
145145
hostcopy[offset + 1] = '2';
146146
hostcopy[offset + 2] = '5';
147147
memcpy(hostcopy + offset + 3, uptr->hostname + offset + 1,
148148
len - offset - 1);
149-
hostcopy[len + 1] = '\0';
149+
hostcopy[len + 2] = '\0';
150150

151151
return hostcopy;
152152
}

0 commit comments

Comments
 (0)