svn commit: r1936817 - in apr/apr-util/branches/1.6.x: . dbd
[email protected] Mon, 03 Aug 2026 12:38:04 -0000
| Newsgroups | gmane.comp.apache.apr.cvs |
|---|---|
| Message-ID | <178576068438.1840379.11673654548066427265@svn03-he-fi> |
Author: covener
Date: Mon Aug 3 12:38:04 2026
New Revision: 1936817
Log:
Merge r1936816 from aprutil 1.7.x:
Merge r1936814 from apr trunk:
apr_dbd: oracle escaping
Reviewed By: covener, jorton, jfclere
Modified:
apr/apr-util/branches/1.6.x/ (props changed)
apr/apr-util/branches/1.6.x/dbd/apr_dbd_oracle.c
Modified: apr/apr-util/branches/1.6.x/dbd/apr_dbd_oracle.c
==============================================================================
--- apr/apr-util/branches/1.6.x/dbd/apr_dbd_oracle.c Mon Aug 3 12:35:16 2026 (r1936816)
+++ apr/apr-util/branches/1.6.x/dbd/apr_dbd_oracle.c Mon Aug 3 12:38:04 2026 (r1936817)
@@ -848,7 +848,25 @@ static int dbd_oracle_query(apr_dbd_t *s
static const char *dbd_oracle_escape(apr_pool_t *pool, const char *arg,
apr_dbd_t *sql)
{
- return arg; /* OCI has no concept of string escape */
+ char *newstr, *src, *dst, *sq;
+ int qcount;
+
+ /* return the original if there are no single-quotes */
+ if (!(sq = strchr(s, '\'')))
+ return (char *)s;
+ /* count the single-quotes and allocate a new buffer */
+ for (qcount = 1; (sq = strchr(sq + 1, '\'')); )
+ qcount++;
+ newstr = apr_palloc(pool, strlen(s) + qcount + 1);
+
+ /* move chars, doubling all single-quotes */
+ src = (char *)s;
+ for (dst = newstr; *src; src++) {
+ if ((*dst++ = *src) == '\'')
+ *dst++ = '\'';
+ }
+ *dst = 0;
+ return newstr;
}
static int dbd_oracle_prepare(apr_pool_t *pool, apr_dbd_t *sql,