Skip to content

Commit

Permalink
Fix overflow in mariadb_thread_id and mariadb_warning_count attributes
Browse files Browse the repository at this point in the history
Functions mysql_thread_id() and mysql_warning_count() return unsigned
values, therefore use newSVuv() for constructing scalar from unsigned
integer value.
  • Loading branch information
pali committed Nov 29, 2018
1 parent 07042e3 commit 3ec7432
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dbdimp.c
Expand Up @@ -3561,9 +3561,9 @@ SV* mariadb_db_FETCH_attrib(SV *dbh, imp_dbh_t *imp_dbh, SV *keysv)
else if (memEQs(key, kl, "mariadb_server_prepare_disable_fallback"))
result = boolSV(imp_dbh->disable_fallback_for_server_prepare);
else if (memEQs(key, kl, "mariadb_thread_id"))
result = imp_dbh->pmysql ? sv_2mortal(newSViv(mysql_thread_id(imp_dbh->pmysql))) : &PL_sv_undef;
result = imp_dbh->pmysql ? sv_2mortal(newSVuv(mysql_thread_id(imp_dbh->pmysql))) : &PL_sv_undef;
else if (memEQs(key, kl, "mariadb_warning_count"))
result = imp_dbh->pmysql ? sv_2mortal(newSViv(mysql_warning_count(imp_dbh->pmysql))) : &PL_sv_undef;
result = imp_dbh->pmysql ? sv_2mortal(newSVuv(mysql_warning_count(imp_dbh->pmysql))) : &PL_sv_undef;
else if (memEQs(key, kl, "mariadb_use_result"))
result = boolSV(imp_dbh->use_mysql_use_result);
else
Expand Down

0 comments on commit 3ec7432

Please sign in to comment.