File 0001-Fix-buffer-overflow-in-Backup.Creator.patch of Package gammu

From ec7e2902c19a886578062979e2749372bfea0380 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
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
---
 include/gammu-backup.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/gammu-backup.h b/include/gammu-backup.h
index e7fbc6e74..d5574ea7a 100644
--- 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
 	 */
-- 
2.36.1

openSUSE Build Service is sponsored by