[prev in list] [next in list] [prev in thread] [next in thread]
List: apr-cvs
Subject: svn commit: r1916390 - /apr/apr/trunk/encoding/apr_escape.c
From: ylavic () apache ! org
Date: 2024-03-18 15:09:12
Message-ID: 20240318150912.421E617AF51 () svn01-us-east ! apache ! org
[Download RAW message or body]
Author: ylavic
Date: Mon Mar 18 15:09:11 2024
New Revision: 1916390
URL: http://svn.apache.org/viewvc?rev=1916390&view=rev
Log:
apr_escape_entity(): Don't truncate the final ';' in hex entities.
apr_snprintf() takes the buffer size (include NUL), and can by used with
NULL/zero-size buffer to determine the output length.
Modified:
apr/apr/trunk/encoding/apr_escape.c
Modified: apr/apr/trunk/encoding/apr_escape.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/encoding/apr_escape.c?rev=1916390&r1=1916389&r2=1916390&view=diff
==============================================================================
--- apr/apr/trunk/encoding/apr_escape.c (original)
+++ apr/apr/trunk/encoding/apr_escape.c Mon Mar 18 15:09:11 2024
@@ -571,7 +571,7 @@ APR_DECLARE(apr_status_t) apr_escape_ent
found = 1;
}
else if (toasc && !apr_isascii(c)) {
- int offset = apr_snprintf((char *) d, 6, "&#%3.3d;", c);
+ int offset = apr_snprintf((char *) d, 7, "&#%3.3d;", c);
size += offset;
d += offset;
found = 1;
@@ -613,8 +613,7 @@ APR_DECLARE(apr_status_t) apr_escape_ent
found = 1;
}
else if (toasc && !apr_isascii(c)) {
- char buf[8];
- size += apr_snprintf(buf, 6, "&#%3.3d;", c);
+ size += apr_snprintf(NULL, 0, "&#%3.3d;", c);
found = 1;
}
else {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic