diff --git a/dos2unix-c-missing-arg.patch b/dos2unix-c-missing-arg.patch new file mode 100644 index 0000000..ff63e67 --- /dev/null +++ b/dos2unix-c-missing-arg.patch @@ -0,0 +1,42 @@ +diff -up dos2unix-3.1/dos2unix.c.c-missing-arg dos2unix-3.1/dos2unix.c +--- dos2unix-3.1/dos2unix.c.c-missing-arg 2008-01-18 09:24:21.000000000 +0000 ++++ dos2unix-3.1/dos2unix.c 2008-01-18 09:25:43.000000000 +0000 +@@ -533,19 +533,28 @@ int main (int argc, char *argv[]) + + if ((strcmp(argv[ArgIdx],"-c") == 0) || (strcmp(argv[ArgIdx],"--convmode") == 0)) + { +- ArgIdx++; +- if (strcmpi(argv[ArgIdx],"ASCII") == 0) +- pFlag->ConvMode = 0; +- else if (strcmpi(argv[ArgIdx], "7Bit") == 0) +- pFlag->ConvMode = 1; +- else if (strcmpi(argv[ArgIdx], "ISO") == 0) +- pFlag->ConvMode = 2; +- else if (strcmpi(argv[ArgIdx], "Mac") == 0) +- pFlag->ConvMode = 3; ++ if (++ArgIdx < argc) ++ { ++ if (strcmpi(argv[ArgIdx],"ASCII") == 0) ++ pFlag->ConvMode = 0; ++ else if (strcmpi(argv[ArgIdx], "7Bit") == 0) ++ pFlag->ConvMode = 1; ++ else if (strcmpi(argv[ArgIdx], "ISO") == 0) ++ pFlag->ConvMode = 2; ++ else if (strcmpi(argv[ArgIdx], "Mac") == 0) ++ pFlag->ConvMode = 3; ++ else ++ { ++ if (!pFlag->Quiet) ++ fprintf(stderr, "dos2unix: invalid %s conversion mode specified\n",argv[ArgIdx]); ++ ShouldExit = 1; ++ } ++ } + else + { ++ ArgIdx--; + if (!pFlag->Quiet) +- fprintf(stderr, "dos2unix: invalid %s conversion mode specified\n",argv[ArgIdx]); ++ fprintf(stderr,"dos2unix: option `%s' requires an argument\n",argv[ArgIdx]); + ShouldExit = 1; + } + } diff --git a/dos2unix.spec b/dos2unix.spec index f994841..0746b10 100644 --- a/dos2unix.spec +++ b/dos2unix.spec @@ -1,7 +1,7 @@ Summary: Text file format converter Name: dos2unix Version: 3.1 -Release: 29%{?dist} +Release: 30%{?dist} Group: Applications/Text License: Freely distributable Source: %{name}-%{version}.tar.bz2 @@ -11,6 +11,7 @@ Patch2: dos2unix-3.1-safeconv.patch Patch3: dos2unix-3.1-manpage-update-57507.patch Patch4: dos2unix-3.1-preserve-file-modes.patch Patch5: dos2unix-3.1-tmppath.patch +Patch6: dos2unix-c-missing-arg.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -25,6 +26,7 @@ Dos2unix converts DOS or MAC text files to UNIX format. %patch3 -p1 -b .manpage-update-57507 %patch4 -p1 -b .preserve-file-modes %patch5 -p1 -b .tmppath +%patch6 -p1 -b .c-missing-arg for I in *.[ch]; do sed -e 's,#endif.*,#endif,g' -e 's,#else.*,#else,g' $I > $I.new @@ -57,6 +59,9 @@ install -p -m444 mac2unix.1 $RPM_BUILD_ROOT%{_mandir}/man1 rm -rf $RPM_BUILD_ROOT %changelog +* Fri Jan 18 2008 Tim Waugh 3.1-30 +- Applied patch from bug #292100 to fix segfault with missing -c argument. + * Wed Aug 29 2007 Tim Waugh 3.1-29 - Rebuild.