Skip to content

Commit b1fd347

Browse files
committed
mysqlnd: change uses of sprintf into snprintf
1 parent cbb81b8 commit b1fd347

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext/mysqlnd/mysqlnd_statistics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING
203203
for (i = 0; i < stats->count; i++) {
204204
char tmp[25];
205205

206-
sprintf((char *)&tmp, "%" PRIu64, stats->values[i]);
206+
snprintf(tmp, sizeof(tmp), "%" PRIu64, stats->values[i]);
207207
add_assoc_string_ex(return_value, names[i].s, names[i].l, tmp);
208208
}
209209
}

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ php_mysqlnd_rowp_read_text_protocol(MYSQLND_ROW_BUFFER * row_buffer, zval * fiel
15741574
if (Z_TYPE_P(current_field) == IS_LONG && !as_int_or_float) {
15751575
/* we are using the text protocol, so convert to string */
15761576
char tmp[22];
1577-
const size_t tmp_len = sprintf((char *)&tmp, ZEND_ULONG_FMT, Z_LVAL_P(current_field));
1577+
const size_t tmp_len = snprintf(tmp, sizeof(tmp), ZEND_ULONG_FMT, Z_LVAL_P(current_field));
15781578
ZVAL_STRINGL(current_field, tmp, tmp_len);
15791579
} else if (Z_TYPE_P(current_field) == IS_STRING) {
15801580
/* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one */

0 commit comments

Comments
 (0)