[packages/camwire] - rediffed link patch, added bounds patch (fix warnings on strncpy); release 2 (libdc1394 2.2.7)
qboosh
qboosh at pld-linux.org
Sun Jul 9 12:58:30 CEST 2023
commit ed2eb3879e6a014793014281d82db61698170876
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Jul 9 11:59:20 2023 +0200
- rediffed link patch, added bounds patch (fix warnings on strncpy); release 2 (libdc1394 2.2.7)
camwire-bounds.patch | 39 +++++++++++++++++++++++++++++++++++++++
camwire-link.patch | 11 +++++------
camwire.spec | 10 +++++++---
3 files changed, 51 insertions(+), 9 deletions(-)
---
diff --git a/camwire.spec b/camwire.spec
index 77381d9..dbeff7d 100644
--- a/camwire.spec
+++ b/camwire.spec
@@ -2,7 +2,7 @@ Summary: Digital camera library for Linux
Summary(pl.UTF-8): Biblioteka obsługi kamer cyfrowych dla Linuksa
Name: camwire
Version: 2.0.0
-Release: 1
+Release: 2
License: LGPL v2.1+
Group: Libraries
# camwire1 was for libdc1394 < 2.0, camwire2 for libdc1394 2.1+
@@ -13,6 +13,7 @@ Patch1: %{name}-etc.patch
Patch2: %{name}-lib.patch
Patch3: %{name}-bogus-inline.patch
Patch4: %{name}-format.patch
+Patch5: %{name}-bounds.patch
URL: http://kauri.auck.irl.cri.nz/~johanns/camwire/
BuildRequires: SDL-devel
BuildRequires: cmake >= 2.6
@@ -79,17 +80,20 @@ Camwire.
%patch2 -p1
%patch3 -p1
%patch4 -p1
+%patch5 -p1
%build
+install -d build
+cd build
# disable unused-result warning, compilation failure with -Werror
CFLAGS="%{rpmcflags} -Wno-unused-result"
-%cmake
+%cmake ..
%{__make} -j1
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} install \
+%{__make} -C build install \
DESTDIR=$RPM_BUILD_ROOT
%clean
diff --git a/camwire-bounds.patch b/camwire-bounds.patch
new file mode 100644
index 0000000..3339214
--- /dev/null
+++ b/camwire-bounds.patch
@@ -0,0 +1,39 @@
+--- camwire2-2.0.0-Source/examples/cammonitor/cammonitor.c.orig 2023-07-09 10:46:29.034985838 +0200
++++ camwire2-2.0.0-Source/examples/cammonitor/cammonitor.c 2023-07-09 11:49:33.674482685 +0200
+@@ -2340,20 +2340,23 @@ static void filename_framenumber(char *n
+ const int strip,
+ const long frameno)
+ {
+- size_t namelen, tokenindex;
++ size_t namelen, tokenindex, outlen;
+ char *token;
+
+ namelen = strlen(filename);
+ token = strstr(filename, FRAMENUMBER_TOKEN);
+ if (token == NULL) tokenindex = namelen;
+ else tokenindex = token - filename;
+- strncpy(new_name, filename, tokenindex);
+- new_name[tokenindex] = '\0';
++
++ outlen = (tokenindex < MAX_FILENAME - 12) ? tokenindex : (MAX_FILENAME - 12);
++ memcpy(new_name, filename, outlen);
++ new_name[outlen] = '\0';
+ if (token != NULL)
+ {
+ if (!strip) sprintf(&new_name[tokenindex], "%011ld", frameno);
+ tokenindex += strlen(FRAMENUMBER_TOKEN);
+ }
++ if (tokenindex + strlen(filename + tokenindex) + 1 <= MAX_FILENAME)
+ strcat(new_name, &filename[tokenindex]);
+ }
+
+@@ -2817,7 +2820,8 @@ static void settings_load(const Camwire_
+ set->save_num_images = new_settings.save_num_images;
+ set->save_delay = new_settings.save_delay;
+ strncpy(set->imagefilename, new_settings.imagefilename,
+- MAX_FILENAME);
++ MAX_FILENAME-1);
++ set->imagefilename[MAX_FILENAME-1] = '\0';
+ }
+ else
+ {
diff --git a/camwire-link.patch b/camwire-link.patch
index 1069a82..ad1397c 100644
--- a/camwire-link.patch
+++ b/camwire-link.patch
@@ -8,18 +8,17 @@
# What to install where:
install (TARGETS camwire camwire_static DESTINATION lib)
---- camwire2-1.9.0-Source/examples/cammonitor/CMakeLists.txt.orig 2011-02-17 03:31:14.000000000 +0100
-+++ camwire2-1.9.0-Source/examples/cammonitor/CMakeLists.txt 2011-08-07 07:21:57.196383177 +0200
-@@ -15,7 +15,8 @@ set_target_properties (cammonitor PROPER
- LINK_FLAGS ${Camwire_SDL_LIBS}
+--- camwire2-2.0.0-Source/examples/cammonitor/CMakeLists.txt.orig 2023-07-09 10:42:48.799512289 +0200
++++ camwire2-2.0.0-Source/examples/cammonitor/CMakeLists.txt 2023-07-09 10:45:58.818482868 +0200
+@@ -20,7 +20,7 @@ set_target_properties (cammonitor PROPER
+ # LINK_FLAGS ${Camwire_SDL_LIBS}
SKIP_BUILD_RPATH ON)
target_link_libraries (cammonitor
- libcamwire.a
+ camwire
-+ SDL
dc1394
+ ${Camwire_SDL_LIBS}
netpbm
- m
--- camwire2-1.9.0-Source/examples/CMakeLists.txt.orig 2011-02-17 03:31:14.000000000 +0100
+++ camwire2-1.9.0-Source/examples/CMakeLists.txt 2011-08-07 07:21:45.499716516 +0200
@@ -9,7 +9,7 @@ add_executable (hello hello.c)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/camwire.git/commitdiff/ed2eb3879e6a014793014281d82db61698170876
More information about the pld-cvs-commit
mailing list