diff options
author | Remi Collet <remi@remirepo.net> | 2023-10-13 10:11:23 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2023-10-13 10:11:23 +0200 |
commit | 393b64580b99cbca00d7ea752b56708b3f9f6979 (patch) | |
tree | 36bbd90d9ffa7d370d78a1d5ecb38dfacb6d9129 | |
parent | b324c21c9152b5c0b7dbdd0c2f412dcdebded4ac (diff) |
fix stack smashing on 32-bit
-rw-r--r-- | package.xml | 2 | ||||
-rw-r--r-- | rpminfo.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/package.xml b/package.xml index 87f4c2b..0883ab2 100644 --- a/package.xml +++ b/package.xml @@ -24,7 +24,7 @@ Documentation: https://www.php.net/rpminfo </stability> <license uri="https://www.php.net/license/3_01.txt" filesource="LICENSE">PHP-3.01</license> <notes> -- +- fix stack smashing on 32-bit </notes> <contents> <dir name="/"> @@ -618,7 +618,11 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) STREAM_DATA_FROM_STREAM(); if (self) { - return rpmfiStat(self->fi, 0, &ssb->sb); + struct stat s[2]; // librpm may use different size (32-bit) + int rc; + rc = rpmfiStat(self->fi, 0, s); + memcpy(&ssb->sb, s, sizeof(ssb->sb)); + return rc; } return -1; } @@ -761,7 +765,9 @@ static int php_stream_rpm_stat(php_stream_wrapper *wrapper, const char *url, int self = php_stream_rpm_finder(url); if (self) { - rc = rpmfiStat(self->fi, 0, &ssb->sb); + struct stat s[2]; // librpm may use different size (32-bit) + rc = rpmfiStat(self->fi, 0, s); + memcpy(&ssb->sb, s, sizeof(ssb->sb)); php_rpm_ops_free(self, 1); } |