Gentoo Archives: gentoo-commits

From: "Markos Chandras (hwoarang)" <hwoarang@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-video/avidemux/files: avidemux-2.5.3-fix-fgets-fortify.patch
Date: Tue, 05 Oct 2010 18:03:37
Message-Id: 20101005174025.F23982003C@flycatcher.gentoo.org
1 hwoarang 10/10/05 17:40:25
2
3 Added: avidemux-2.5.3-fix-fgets-fortify.patch
4 Log:
5 Apply patch to fix possible buffer overflows. Thanks to Kevin Pyle for the patch. Bug #338619
6
7 (Portage version: 2.2_rc86/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 media-video/avidemux/files/avidemux-2.5.3-fix-fgets-fortify.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/avidemux/files/avidemux-2.5.3-fix-fgets-fortify.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/avidemux/files/avidemux-2.5.3-fix-fgets-fortify.patch?rev=1.1&content-type=text/plain
14
15 Index: avidemux-2.5.3-fix-fgets-fortify.patch
16 ===================================================================
17 Switch calls of fgets from using magic numbers to using sizeof() to
18 ensure that the size passed to fgets is consistent with the size
19 allocated by the compiler.
20
21 diff -ru a/plugins/ADM_videoFilters/Srt/ADM_vidSRTload.cpp b/plugins/ADM_videoFilters/Srt/ADM_vidSRTload.cpp
22 --- a/plugins/ADM_videoFilters/Srt/ADM_vidSRTload.cpp 2009-12-19 20:41:13.000000000 +0000
23 +++ b/plugins/ADM_videoFilters/Srt/ADM_vidSRTload.cpp 2010-10-02 21:02:59.000000000 +0000
24 @@ -86,7 +86,7 @@
25 return 0;
26
27 }
28 - while (fgets (string, 200, _fd))
29 + while (fgets (string, sizeof(string), _fd))
30 {
31 _line++;
32 }
33 @@ -104,7 +104,7 @@
34 //
35 for (uint32_t i = 0; i < _line; i++)
36 {
37 - fgets (string, ADM_RAW, _fd);
38 + fgets (string, sizeof(string), _fd);
39 //printf("\n in : %s ",string);
40 if (string[0] != '{')
41 continue;
42 @@ -250,7 +250,7 @@
43 // first cound how many line
44 line = 0;
45 _line = 0;
46 - while (fgets (string, 300, _fd))
47 + while (fgets (string, sizeof(string), _fd))
48 line++;
49 printf ("\n subs : %ld lines\n", line);
50 // rewind
51 @@ -272,7 +272,7 @@
52 for (uint32_t i = 0; i < line; i++)
53 {
54 current=&_subs[_line];
55 - fgets (string, ADM_RAW, _fd);
56 + fgets (string, sizeof(string), _fd);
57 ADM_utfConv(final,string,strlen(string),&finallen);
58 // Purge cr/lf
59 switch (state)