commit:     10727586735882a48d57d0c41cb44a7a535645dd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  7 16:38:11 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar  7 16:58:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10727586

app-mobilephone/gammu: fix runtime w/ FORTIFY_SOURCE=3

Closes: https://bugs.gentoo.org/854324
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/gammu-1.42.0-fortify-source-3.patch      | 31 ++++++++++++++++++++++
 ...{gammu-1.42.0.ebuild => gammu-1.42.0-r1.ebuild} |  9 ++++---
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/app-mobilephone/gammu/files/gammu-1.42.0-fortify-source-3.patch 
b/app-mobilephone/gammu/files/gammu-1.42.0-fortify-source-3.patch
new file mode 100644
index 000000000000..dba1ca50ec6d
--- /dev/null
+++ b/app-mobilephone/gammu/files/gammu-1.42.0-fortify-source-3.patch
@@ -0,0 +1,31 @@
+https://bugs.gentoo.org/854324
+https://github.com/gammu/gammu/commit/a37e5d8054f863fa71e38e244dd4da13eee6e251
+
+From a37e5d8054f863fa71e38e244dd4da13eee6e251 Mon Sep 17 00:00:00 2001
+From: Martin Liska <[email protected]>
+Date: Mon, 20 Jun 2022 10:24:13 +0200
+Subject: [PATCH] Fix buffer overflow in Backup.Creator
+
+I noticed that while testing the upcoming GCC 12 with -D_FORTIFY_SOURCE=3:
+here I have
+
+$1 = 0x7ffff7f0f940 <Buffer.1.lto_priv.1> "Linux, kernel 5.16.14-1-default (#1 
SMP PREEMPT Fri Mar 11 12:33:34 UTC 2022 (80acc65))"
+(gdb) p (int)strlen(GetOS())
+$3 = 87
+so GetOS() returns 87 chars while:
+
+include/gammu-backup.h: char Creator[80];
+
+Fixes: #701
+--- a/include/gammu-backup.h
++++ b/include/gammu-backup.h
+@@ -218,7 +218,7 @@ typedef struct {
+       /**
+        * Name of program which created backup
+        */
+-      char Creator[80];
++      char Creator[512];
+       /**
+        * Timestamp of backup
+        */
+

diff --git a/app-mobilephone/gammu/gammu-1.42.0.ebuild 
b/app-mobilephone/gammu/gammu-1.42.0-r1.ebuild
similarity index 88%
rename from app-mobilephone/gammu/gammu-1.42.0.ebuild
rename to app-mobilephone/gammu/gammu-1.42.0-r1.ebuild
index 79bd7daa5e61..ba396cb0f1fc 100644
--- a/app-mobilephone/gammu/gammu-1.42.0.ebuild
+++ b/app-mobilephone/gammu/gammu-1.42.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2022 Gentoo Authors
+# Copyright 2022-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -35,8 +35,11 @@ RDEPEND="
        ${COMMON_DEPEND}
        dev-util/dialog
 "
-PATCHES=( "${FILESDIR}/${P}-CMP0110-policy.patch"
-       "${FILESDIR}/${P}-gammu-detect.patch" )
+PATCHES=(
+       "${FILESDIR}/${P}-CMP0110-policy.patch"
+       "${FILESDIR}/${P}-gammu-detect.patch"
+       "${FILESDIR}/${P}-fortify-source-3.patch"
+)
 
 src_configure() {
        local mycmakeargs=(

Reply via email to