diff --git a/xclip-fix-segfault-bz1947285.patch b/xclip-fix-segfault-bz1947285.patch new file mode 100644 index 0000000..d9a532c --- /dev/null +++ b/xclip-fix-segfault-bz1947285.patch @@ -0,0 +1,30 @@ +diff -up xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c.1947285 xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c +--- xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c.1947285 2020-11-08 09:01:39.000000000 -0500 ++++ xclip-11cba613840b0d0e76dc2ea6d4ec7cc5f23daf88/xclip.c 2021-06-10 13:19:23.803190933 -0400 +@@ -714,9 +714,9 @@ static int + doOut(Window win) + { + Atom sel_type = None; +- unsigned char *sel_buf; /* buffer for selection data */ +- unsigned long sel_len = 0; /* length of sel_buf */ +- XEvent evt; /* X Event Structures */ ++ unsigned char *sel_buf = NULL; /* buffer for selection data */ ++ unsigned long sel_len = 0; /* length of sel_buf */ ++ XEvent evt; /* X Event Structures */ + unsigned int context = XCLIB_XCOUT_NONE; + + if (sseln == XA_STRING) +@@ -743,9 +743,11 @@ doOut(Window win) + /* If user requested -sensitive, then prevent further pastes (even though we failed to paste) */ + XSetSelectionOwner(dpy, sseln, None, CurrentTime); + /* Clear memory buffer */ +- xcmemzero(sel_buf,sel_len); ++ if (sel_buf != NULL) ++ xcmemzero(sel_buf,sel_len); + } +- free(sel_buf); ++ if (sel_buf != NULL) ++ free(sel_buf); + errconvsel(dpy, target, sseln); + // errconvsel does not return but exits with EXIT_FAILURE + } diff --git a/xclip.spec b/xclip.spec index 2b698b4..1d4c368 100644 --- a/xclip.spec +++ b/xclip.spec @@ -3,13 +3,14 @@ Name: xclip Version: 0.13 -Release: 13.git%{shortcommit}%{?dist} +Release: 14.git%{shortcommit}%{?dist} License: GPLv2+ Summary: Command line clipboard grabber URL: http://sourceforge.net/projects/xclip # Source0: https://github.com/astrand/xclip/archive/%%{version}.tar.gz Source0: https://github.com/astrand/xclip/archive/%{commit}/%{name}-%{shortcommit}.tar.gz -BuildRequires: make +Patch0: xclip-fix-segfault-bz1947285.patch +BuildRequires: make BuildRequires: libXmu-devel, libICE-devel, libX11-devel, libXext-devel BuildRequires: autoconf, automake, libtool @@ -23,6 +24,7 @@ another program. %prep %setup -q -n %{name}-%{commit} +%patch0 -p1 -b .1947285 autoreconf -ifv %build @@ -43,6 +45,9 @@ make DESTDIR=$RPM_BUILD_ROOT install.man %{_mandir}/man1/xclip*.1* %changelog +* Thu Jun 10 2021 Tom Callaway - 0.13-14.git11cba61 +- apply Jerry James's fix for the segfault in bz1947285 + * Mon Apr 26 2021 Tom Callaway - 0.13-13.git11cba61 - update to latest from git