Skip to content

Commit 095f622

Browse files
committed
Fix?
1 parent af0fd86 commit 095f622

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

ext/pdo_dblib/dblib_driver.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,19 @@ static zend_string* dblib_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquo
172172
}
173173
quoted_str = zend_string_alloc(quotedlen, 0);
174174
if (use_national_character_set) {
175-
*ZSTR_VAL(quoted_str)++ = 'N';
175+
*(ZSTR_VAL(quoted_str))++ = 'N';
176176
}
177-
*ZSTR_VAL(quoted_str)++ = '\'';
177+
*(ZSTR_VAL(quoted_str))++ = '\'';
178178

179179
for (i = 0; i < ZSTR_LEN(unquoted); i++) {
180180
if (ZSTR_VAL(unquoted)[i] == '\'') {
181-
*ZSTR_VAL(quoted_str)++ = '\'';
182-
*ZSTR_VAL(quoted_str)++ = '\'';
181+
*(ZSTR_VAL(quoted_str))++ = '\'';
182+
*(ZSTR_VAL(quoted_str))++ = '\'';
183183
} else {
184-
*ZSTR_VAL(quoted_str)++ = ZSTR_VAL(unquoted)[i];
184+
*(ZSTR_VAL(quoted_str))++ = ZSTR_VAL(unquoted)[i];
185185
}
186186
}
187-
*ZSTR_VAL(quoted_str) = '\'';
187+
*(ZSTR_VAL(quoted_str)) = '\'';
188188
return quoted_str;
189189
}
190190

ext/pdo_firebird/firebird_driver.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ static zend_string* firebird_handle_quoter(pdo_dbh_t *dbh, const zend_string *un
654654
int qcount = 0;
655655
char const *co, *l, *r;
656656
size_t quotedlen;
657+
char *start;
657658
zend_string *quoted_str;
658659

659660
if (ZSTR_LEN(unquoted) == 0) {
@@ -666,18 +667,19 @@ static zend_string* firebird_handle_quoter(pdo_dbh_t *dbh, const zend_string *un
666667

667668
quotedlen = ZSTR_LEN(unquoted) + qcount + 2;
668669
quoted_str = zend_string_alloc(quotedlen, 0);
669-
*ZSTR_VAL(quoted_str)++ = '\'';
670+
start = ZSTR_VAL(quoted_str);
671+
*(ZSTR_VAL(quoted_str))++ = '\'';
670672

671673
/* foreach (chunk that ends in a quote) */
672674
for (l = ZSTR_VAL(unquoted); (r = strchr(l,'\'')); l = r+1) {
673675
strncpy(ZSTR_VAL(quoted_str), l, r-l+1);
674-
ZSTR_VAL(quoted_str) += (r-l+1);
676+
*(ZSTR_VAL(quoted_str)) += (r-l+1);
675677
/* add the second quote */
676-
*ZSTR_VAL(quoted_str)++ = '\'';
678+
*(ZSTR_VAL(quoted_str))++ = '\'';
677679
}
678680

679681
/* copy the remainder */
680-
strncpy(ZSTR_VAL(quoted_str), l, quotedlen-(c-quoted)-1);
682+
strncpy(ZSTR_VAL(quoted_str), l, quotedlen-(start-ZSTR_VAL(quoted_str))-1);
681683
ZSTR_VAL(quoted_str)[quotedlen-1] = '\'';
682684
ZSTR_VAL(quoted_str)[quotedlen] = '\0';
683685

0 commit comments

Comments
 (0)