You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rp...@apache.org on 2025/08/21 09:59:44 UTC

svn commit: r1927941 - apr/apr/trunk/uri

Author: rpluem
Date: Thu Aug 21 09:59:44 2025
New Revision: 1927941

Log:
* The off by one was on the allocation, not on the write

Modified:
   apr/apr/trunk/uri/apr_uri.c

Modified: apr/apr/trunk/uri/apr_uri.c
==============================================================================
--- apr/apr/trunk/uri/apr_uri.c	Thu Aug 21 09:31:39 2025	(r1927940)
+++ apr/apr/trunk/uri/apr_uri.c	Thu Aug 21 09:59:44 2025	(r1927941)
@@ -140,13 +140,13 @@ static char * percent_encode_scope_zone_
 
     offset = s - uptr->hostname;
 
-    hostcopy = apr_palloc(p, len + 2);
+    hostcopy = apr_palloc(p, len + 3);
     memcpy(hostcopy, uptr->hostname, offset + 1);
     hostcopy[offset + 1] = '2';
     hostcopy[offset + 2] = '5';
     memcpy(hostcopy + offset + 3, uptr->hostname + offset + 1,
            len - offset - 1);
-    hostcopy[len + 1] = '\0';
+    hostcopy[len + 2] = '\0';
 
     return hostcopy;
 }