From 393b64580b99cbca00d7ea752b56708b3f9f6979 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 13 Oct 2023 10:11:23 +0200 Subject: fix stack smashing on 32-bit --- rpminfo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rpminfo.c') diff --git a/rpminfo.c b/rpminfo.c index 70676f7..7eb992e 100644 --- a/rpminfo.c +++ b/rpminfo.c @@ -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); } -- cgit