summarylogtreecommitdiffstats
path: root/buffer-overflow.patch
blob: cc60be52fbed58f965b30326872c762b1570fdcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From: Steve Kemp <skx@debian.org>
Date: Sat, 22 Mar 2014 16:04:16 +0100
Subject: buffer overflow

Bug: https://bugs.debian.org/203508
Forwarded: no
---
 tuxpuck.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tuxpuck.c b/tuxpuck.c
index 4c0d6d7..76ecbb6 100644
--- a/tuxpuck.c
+++ b/tuxpuck.c
@@ -250,7 +250,9 @@ static void _tuxpuck_init(void)
   _settings->mouse_speed = 5;
 #ifndef windows
   homeDir = getenv("HOME");
-  sprintf(_settings_file, "%s/.tuxpuckrc", homeDir);
+  /* Buffer overflow fixed!
+   * sprintf(_settings_file, "%s/.tuxpuckrc", homeDir); */
+  snprintf(_settings_file, sizeof(_settings_file)-1, "%s/.tuxpuckrc", homeDir);
 #endif
   _read_settings();
   audio_set_mute(!_settings->sound);