fix segfault with corrupted metadata in code_ns_fraction(#531441)
This commit is contained in:
parent
88bee905ac
commit
b0701b539d
@ -1,12 +1,25 @@
|
|||||||
diff -urNp tar-1.22-orig/src/misc.c tar-1.22/src/misc.c
|
diff -urNp tar-1.22-orig/src/misc.c tar-1.22/src/misc.c
|
||||||
--- tar-1.22-orig/src/misc.c 2007-06-27 15:30:32.000000000 +0200
|
--- tar-1.22-orig/src/misc.c 2007-06-27 15:30:32.000000000 +0200
|
||||||
+++ tar-1.22/src/misc.c 2009-12-08 13:41:46.000000000 +0100
|
+++ tar-1.22/src/misc.c 2010-02-04 12:05:00.000000000 +0100
|
||||||
@@ -228,7 +228,7 @@ code_ns_fraction (int ns, char *p)
|
@@ -255,7 +255,20 @@ code_timespec (struct timespec t, char s
|
||||||
*p = '\0';
|
time_t s = t.tv_sec;
|
||||||
else
|
int ns = t.tv_nsec;
|
||||||
{
|
char *np;
|
||||||
- int i = 9;
|
- bool negative = s < 0;
|
||||||
+ int i = 10;
|
+ bool negative;
|
||||||
*p++ = '.';
|
+
|
||||||
|
+ /* ignore any negative ns value */
|
||||||
|
+ if (ns < 0)
|
||||||
|
+ ns = 0;
|
||||||
|
+
|
||||||
|
+ /* ensure (ns < BILLION) to avoid SIGSEGV within code_ns_fraction () */
|
||||||
|
+ if (BILLION <= ns )
|
||||||
|
+ {
|
||||||
|
+ s += ns / BILLION;
|
||||||
|
+ ns %= BILLION;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ negative = s < 0;
|
||||||
|
|
||||||
while (ns % 10 == 0)
|
if (negative && ns != 0)
|
||||||
|
{
|
||||||
|
8
tar.spec
8
tar.spec
@ -5,7 +5,7 @@ Summary: A GNU file archiving program
|
|||||||
Name: tar
|
Name: tar
|
||||||
Epoch: 2
|
Epoch: 2
|
||||||
Version: 1.22
|
Version: 1.22
|
||||||
Release: 14%{?dist}
|
Release: 15%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Applications/Archiving
|
Group: Applications/Archiving
|
||||||
URL: http://www.gnu.org/software/tar/
|
URL: http://www.gnu.org/software/tar/
|
||||||
@ -69,7 +69,7 @@ the rmt package.
|
|||||||
%patch6 -p1 -b .shortread
|
%patch6 -p1 -b .shortread
|
||||||
%patch7 -p1 -b .headerblackmagic
|
%patch7 -p1 -b .headerblackmagic
|
||||||
%patch8 -p1 -b .xheaderleak
|
%patch8 -p1 -b .xheaderleak
|
||||||
#%patch9 -p1 -b .nsfraction #causing stack smashing, do not apply
|
%patch9 -p1 -b .nsfraction
|
||||||
%patch10 -p1 -b .utimens
|
%patch10 -p1 -b .utimens
|
||||||
|
|
||||||
autoreconf
|
autoreconf
|
||||||
@ -132,6 +132,10 @@ fi
|
|||||||
%{_infodir}/tar.info*
|
%{_infodir}/tar.info*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 04 2010 Ondrej Vasik <ovasik@redhat.com> 2:1.22-15
|
||||||
|
- fix segfault with corrupted metadata in code_ns_fraction
|
||||||
|
(#531441)
|
||||||
|
|
||||||
* Wed Feb 03 2010 Kamil Dudka <kdudka@redhat.com> 2:1.22-14
|
* Wed Feb 03 2010 Kamil Dudka <kdudka@redhat.com> 2:1.22-14
|
||||||
- allow also build with SELinux support
|
- allow also build with SELinux support
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user