Subject: [alpine-aports] [PATCH 1/3] main/zoneminder: fix zm_logger patch

From: Marc Vertes <[email-masked]>
Date: Sun, 21 Feb 2016 18:34:38 +0000

From: Kaarle Ritvanen <[email-masked]>

---
 main/zoneminder/APKBUILD       |  8 ++++----
 main/zoneminder/musl-fix.patch | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/main/zoneminder/APKBUILD b/main/zoneminder/APKBUILD
index 84a29a7..44ab6ca 100644
--- a/main/zoneminder/APKBUILD
+++ b/main/zoneminder/APKBUILD
@@ -3,7 +3,7 @@
 # Maintainer: Kaarle Ritvanen <[email-masked]>
 pkgname=zoneminder
 pkgver=1.29.0
-pkgrel=5
+pkgrel=6
 pkgdesc="Video camera surveillance system"
 url="http://www.zoneminder.com/"
 arch="x86_64"
@@ -88,19 +88,19 @@ package() {
 
 md5sums="b4de8dd3fd86fc72e929e116e926d901  zoneminder-1.29.0.tar.gz
 ab1fe4fb2392b82acf18ca8412fb927f  zoneminder.initd
-b95482fefbf22e8a89fb061805d05f03  musl-fix.patch
+8b56092baa50847b6b6146693aad0df4  musl-fix.patch
 c7b793be7b48685197acfb5b79470f2c  0001-security-hardening-make-static-files-non-writable-by.patch
 1429766dc44764dc77c735f4320b5a44  0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
 24359849eef7c5293f63136e704fdca4  zm-additional.sql"
 sha256sums="34e1f0d4b616e320e557f8e3fbe278d3ab70f30f6278cc153b44f2193c85ddbd  zoneminder-1.29.0.tar.gz
 887174a6d1489bdcfbadf760758b14ef4e184dfcae728e15cb0e697e61e1c42f  zoneminder.initd
-829551a83e62ff84fcba7a0f88105a0b6d15d89a66e1e98dc50098c30c48672f  musl-fix.patch
+0b6589e096bd2e2f3fa4518309cf6b549c792883aae7014bb978dbc34cce10e6  musl-fix.patch
 7090caf93886b01032a8c4e5585f37e6a3e7ac59cdfdfddfd8150c03dacfd93f  0001-security-hardening-make-static-files-non-writable-by.patch
 a830478a806e36d41016d3c2663d892fafa65b580d3bccccc131fe114c842834  0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
 dea3a1b493bc7d7dbe9c431f565b9e916fb8a8bd29fcd74947b14592ef7f4494  zm-additional.sql"
 sha512sums="71a397df83c92de3b977832bb0a11791a3a756e7219e0cf3dc6c5c30fa0dd488ea00a925433669bf4e79873df980a852f2c805d1b7c9c8a06b6c39b9a16a2fda  zoneminder-1.29.0.tar.gz
 fa993a86c21697467c8f63ce584531f8e2c3da977b65e6557161b4b91807b1c78b14fb64f6f54c50fddcb51b54bae6dff45776f5a69bfcc635a5c2927a292b57  zoneminder.initd
-b2c4e31fd0a31f034be3029eab4f2943e07e95e64bb2d8eb38d93b790059d694a9a007e98b0f9b4c47ecfe91296bc21a3795b8a4aaf5b2a83071251456e533da  musl-fix.patch
+8b49745f787d8a98f093569d44786950658d2adb32bb5d0c6c245c1da6019dc4520d2e05a6610cbea79451d2fb2e3ee054ed221e94d6829bf6278d21a3c11fde  musl-fix.patch
 a7e58312c804f58ac41ee569fefffa99e65beba29f07eff36fb3cf2aa4fd68e1fc903feb73ab0c1fc6c58442251076042b537ab21156b956d7854a86bde14307  0001-security-hardening-make-static-files-non-writable-by.patch
 8a35bfc782792ca559d6cf78e3e17f0caa45e19981cea12090b4f0ececa98bd9a121d2918e06e991ae5c06ab876ffddc94cd4f9db640f510314a3d09a6d90b4c  0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
 0bb99af417441e2c12cb3b8c00ecb8d76bdc343d39092a222841ae0bd684eeba1783a8bccf5630dae56f64992f8a09ec16e0cbc7069665e1ee3b62dd3f96c3a9  zm-additional.sql"
diff --git a/main/zoneminder/musl-fix.patch b/main/zoneminder/musl-fix.patch
index fd48cd5..90b0f38 100644
--- a/main/zoneminder/musl-fix.patch
+++ b/main/zoneminder/musl-fix.patch
@@ -21,14 +21,22 @@
  
  bool Logger::smInitialised = false;
  Logger *Logger::smInstance = 0;
-@@ -504,7 +504,9 @@
+@@ -504,7 +504,8 @@
          va_list         argPtr;
          struct timeval  timeVal;
  
 -        const char * const file = basename(filepath);
-+        char *s = strdup(filepath);
-+        const char * const file = basename(s);
-+        free(s);
++        char *path = strdup(filepath);
++        const char *file = basename(path);
          
          if ( level < PANIC || level > DEBUG9 )
              Panic( "Invalid logger level %d", level );
+@@ -617,6 +618,8 @@
+             //priority |= LOG_DAEMON;
+             syslog( priority, "%s [%s]", classString, syslogStart );
+         }
++
++        free(path);
+ 
+         if ( level <= FATAL )
+         {
-- 
2.7.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Marc Vertes <[email-masked]>
Date: Sun, 21 Feb 2016 18:34:39 +0000

---
 main/zoneminder/APKBUILD | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main/zoneminder/APKBUILD b/main/zoneminder/APKBUILD
index 44ab6ca..e532df8 100644
--- a/main/zoneminder/APKBUILD
+++ b/main/zoneminder/APKBUILD
@@ -3,7 +3,7 @@
 # Maintainer: Kaarle Ritvanen <[email-masked]>
 pkgname=zoneminder
 pkgver=1.29.0
-pkgrel=6
+pkgrel=7
 pkgdesc="Video camera surveillance system"
 url="http://www.zoneminder.com/"
 arch="x86_64"
@@ -40,6 +40,7 @@ prepare() {
 build() {
 	cd "$_builddir"
 	./bootstrap.sh || return 1
+	utils/zmeditconfigdata.sh ZM_CHECK_FOR_UPDATES no
 	ZM_LOGDIR=/var/log/zoneminder \
 		ZM_RUNDIR=/var/run/zoneminder \
 		ZM_SOCKDIR=/var/run/zoneminder \
-- 
2.7.1

---

---

From: Marc Vertes <[email-masked]>
Date: Sun, 21 Feb 2016 18:34:40 +0000

---
 ...01-zm_event-fix-overlap-in-memcpy-buffers.patch | 25 ++++++++++++++++++++++
 main/zoneminder/APKBUILD                           |  6 +++++-
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 main/zoneminder/0001-zm_event-fix-overlap-in-memcpy-buffers.patch

diff --git a/main/zoneminder/0001-zm_event-fix-overlap-in-memcpy-buffers.patch b/main/zoneminder/0001-zm_event-fix-overlap-in-memcpy-buffers.patch
new file mode 100644
index 0000000..02ed868
--- /dev/null
+++ b/main/zoneminder/0001-zm_event-fix-overlap-in-memcpy-buffers.patch
@@ -0,0 +1,25 @@
+From 5b047dc74b4105b39cacc675eabb8ed9f033cee3 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <[email-masked]>
+Date: Sat, 20 Feb 2016 23:58:07 +0200
+Subject: [PATCH] zm_event: fix overlap in memcpy buffers
+
+---
+ src/zm_event.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/zm_event.cpp b/src/zm_event.cpp
+index 1f1fb0f..a34ce50 100644
+--- a/src/zm_event.cpp
++++ b/src/zm_event.cpp
+@@ -1121,7 +1121,7 @@ void EventStream::processCommand( const CmdMsg *msg )
+ 
+     DataMsg status_msg;
+     status_msg.msg_type = MSG_DATA_EVENT;
+-    memcpy( &status_msg.msg_data, &status_data, sizeof(status_msg.msg_data) );
++    memcpy( &status_msg.msg_data, &status_data, sizeof(status_data) );
+     if ( sendto( sd, &status_msg, sizeof(status_msg), MSG_DONTWAIT, (sockaddr *)&rem_addr, sizeof(rem_addr) ) < 0 )
+     {
+         //if ( errno != EAGAIN )
+-- 
+2.5.0
+
diff --git a/main/zoneminder/APKBUILD b/main/zoneminder/APKBUILD
index e532df8..be17a37 100644
--- a/main/zoneminder/APKBUILD
+++ b/main/zoneminder/APKBUILD
@@ -3,7 +3,7 @@
 # Maintainer: Kaarle Ritvanen <[email-masked]>
 pkgname=zoneminder
 pkgver=1.29.0
-pkgrel=7
+pkgrel=8
 pkgdesc="Video camera surveillance system"
 url="http://www.zoneminder.com/"
 arch="x86_64"
@@ -23,6 +23,7 @@ source="zoneminder-$pkgver.tar.gz::https://github.com/ZoneMinder/ZoneMinder/arch
 	$pkgname.initd
 	musl-fix.patch
 	0001-security-hardening-make-static-files-non-writable-by.patch
+	0001-zm_event-fix-overlap-in-memcpy-buffers.patch
 	0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
 	zm-additional.sql"
 
@@ -91,17 +92,20 @@ md5sums="b4de8dd3fd86fc72e929e116e926d901  zoneminder-1.29.0.tar.gz
 ab1fe4fb2392b82acf18ca8412fb927f  zoneminder.initd
 8b56092baa50847b6b6146693aad0df4  musl-fix.patch
 c7b793be7b48685197acfb5b79470f2c  0001-security-hardening-make-static-files-non-writable-by.patch
+bab4a8253fe46154f506437f8d1f6b01  0001-zm_event-fix-overlap-in-memcpy-buffers.patch
 1429766dc44764dc77c735f4320b5a44  0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
 24359849eef7c5293f63136e704fdca4  zm-additional.sql"
 sha256sums="34e1f0d4b616e320e557f8e3fbe278d3ab70f30f6278cc153b44f2193c85ddbd  zoneminder-1.29.0.tar.gz
 887174a6d1489bdcfbadf760758b14ef4e184dfcae728e15cb0e697e61e1c42f  zoneminder.initd
 0b6589e096bd2e2f3fa4518309cf6b549c792883aae7014bb978dbc34cce10e6  musl-fix.patch
 7090caf93886b01032a8c4e5585f37e6a3e7ac59cdfdfddfd8150c03dacfd93f  0001-security-hardening-make-static-files-non-writable-by.patch
+9daa0ed53e23723cb850b23a329eb207f1bcb34920c92c9edce1dc9ea2af4201  0001-zm_event-fix-overlap-in-memcpy-buffers.patch
 a830478a806e36d41016d3c2663d892fafa65b580d3bccccc131fe114c842834  0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
 dea3a1b493bc7d7dbe9c431f565b9e916fb8a8bd29fcd74947b14592ef7f4494  zm-additional.sql"
 sha512sums="71a397df83c92de3b977832bb0a11791a3a756e7219e0cf3dc6c5c30fa0dd488ea00a925433669bf4e79873df980a852f2c805d1b7c9c8a06b6c39b9a16a2fda  zoneminder-1.29.0.tar.gz
 fa993a86c21697467c8f63ce584531f8e2c3da977b65e6557161b4b91807b1c78b14fb64f6f54c50fddcb51b54bae6dff45776f5a69bfcc635a5c2927a292b57  zoneminder.initd
 8b49745f787d8a98f093569d44786950658d2adb32bb5d0c6c245c1da6019dc4520d2e05a6610cbea79451d2fb2e3ee054ed221e94d6829bf6278d21a3c11fde  musl-fix.patch
 a7e58312c804f58ac41ee569fefffa99e65beba29f07eff36fb3cf2aa4fd68e1fc903feb73ab0c1fc6c58442251076042b537ab21156b956d7854a86bde14307  0001-security-hardening-make-static-files-non-writable-by.patch
+ecd32fb6af11144efabec69522615f56462bead0960f820b466a3bb00edf28cb3a80ec705b32abb71217e3a280eb7c50cf956d0a167fdfd3692ca63da1980ab7  0001-zm_event-fix-overlap-in-memcpy-buffers.patch
 8a35bfc782792ca559d6cf78e3e17f0caa45e19981cea12090b4f0ececa98bd9a121d2918e06e991ae5c06ab876ffddc94cd4f9db640f510314a3d09a6d90b4c  0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
 0bb99af417441e2c12cb3b8c00ecb8d76bdc343d39092a222841ae0bd684eeba1783a8bccf5630dae56f64992f8a09ec16e0cbc7069665e1ee3b62dd3f96c3a9  zm-additional.sql"
-- 
2.7.1

---