fix segfault of data-change-warn option (#255261), patch from

dkopecek@redhat.com
This commit is contained in:
Peter Vrabec 2007-08-27 11:55:11 +00:00
parent 900eb24ba9
commit ce8fc6c08d
2 changed files with 92 additions and 1 deletions

View File

@ -0,0 +1,85 @@
--- star-1.5/star/checkerr.c.orig-segv 2006-10-31 18:06:25.000000000 +0100
+++ star-1.5/star/checkerr.c 2007-08-27 11:42:39.000000000 +0200
@@ -183,44 +183,45 @@ LOCAL struct eflags {
*/
LOCAL UInt32_t
errflags(eflag, doexit)
- char *eflag;
- BOOL doexit;
+ char *eflag;
+ BOOL doexit;
{
- register char *p = eflag;
- char *ef = _endword(eflag);
- char ec;
- register struct eflags *ep;
- register int slen;
- register UInt32_t nflags = 0;
-
- ec = *ef;
- *ef = '\0';
- do {
- for (ep = eflags; ep->fname; ep++) {
- slen = strlen(ep->fname);
- if ((strncmp(ep->fname, p, slen) == 0) &&
- (p[slen] == '|' || p[slen] == ' ' ||
- p[slen] == '\0')) {
- nflags |= ep->fval;
- break;
- }
- }
- if (ep->fname == NULL) {
- if (doexit)
- comerrno(EX_BAD, "Bad flag '%s'\n", p);
- *ef = ec; /* Restore old character */
- return (0);
- }
- p = strchr(p, '|');
- } while (p && *p++ == '|');
-
- *ef = ec; /* Restore old character */
- if ((nflags & ~(UInt32_t)(E_ABORT|E_WARN)) == 0) {
- if (doexit)
- comerrno(EX_BAD, "Bad error condition '%s'.\n", eflag);
- return (0);
- }
- return (nflags);
+ register struct eflags *ep;
+ register int slen;
+ register UInt32_t nflags = 0;
+ char *curflags;
+ char *curflag;
+
+ curflags = strdup (eflag);
+ *_endword(curflags) = '\0';
+ curflag = strtok (curflags, "|");
+
+ while (curflag != NULL) {
+ for (ep = eflags; ep->fname; ep++) {
+ slen = strlen (ep->fname);
+ if ((strncmp (ep->fname, curflag, slen)) == 0) {
+ nflags |= ep->fval;
+ goto next;
+ }
+ }
+
+ if (doexit)
+ comerrno (EX_BAD, "Bad flag '%s' \n", curflag);
+
+ free (curflags);
+ return (0);
+ next:
+ curflag = strtok (NULL, "|");
+ }
+
+ free (curflags);
+
+ if ((nflags & ~(UInt32_t)(E_ABORT|E_WARN)) == 0) {
+ if (doexit)
+ comerrno(EX_BAD, "Bad error condition '%s'.\n", eflag);
+ return (0);
+ }
+ return (nflags);
}
LOCAL ec_t *

View File

@ -4,11 +4,12 @@
Summary: An archiving tool with ACL support
Name: star
Version: 1.5a84
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://cdrecord.berlios.de/old/private/star.html
Source: ftp://ftp.berlios.de/pub/star/alpha/%{name}-%{version}.tar.bz2
Patch1: star-1.5-newMake.patch
Patch2: star-1.5-selinux.patch
Patch3: star-1.5-changewarnSegv.patch
License: CDDL
Group: Applications/Archiving
BuildRoot: %{_tmppath}/%{name}-%{version}-root
@ -25,6 +26,7 @@ and can restore individual files from the archive. Star supports ACL.
%if %{WITH_SELINUX}
%patch2 -p1 -b .selinux
%endif
%patch3 -p1 -b .changewarnSegv
for PLAT in %{arm} x86_64 ppc64 s390 s390x; do
for AFILE in gcc cc; do
@ -95,6 +97,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man1/spax.1*
%changelog
* Mon Aug 27 2007 Peter Vrabec <pvrabec@redhat.com> 1.5a84-2
- fix segfault of data-change-warn option (#255261),
patch from dkopecek@redhat.com
* Fri Aug 24 2007 Peter Vrabec <pvrabec@redhat.com> 1.5a84-1
- new upstream release with CVE-2007-4134 fix