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

[email protected]
Newsgroups gmane.comp.apache.apr.cvs
Message-ID <175577038470.3403446.3543823263384408541@svn02-us-east.apache.org>
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;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.