aboutsummaryrefslogtreecommitdiffstats
path: root/main/zoneminder/0001-zm_monitor-fix-overlap-in-memcpy-buffers.patch
blob: 5de984909b17708d63d97338b493ec2f4d40f155 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From 6332f28c5364c3f7b8cd6797c335041a9293ec77 Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Date: Tue, 16 Feb 2016 11:47:49 +0200
Subject: [PATCH] zm_monitor: fix overlap in memcpy buffers

behavior undefined by POSIX and causes a crash with FORTIFY_SOURCE
---
 src/zm_monitor.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp
index 20b8b78..e674879 100644
--- a/src/zm_monitor.cpp
+++ b/src/zm_monitor.cpp
@@ -3981,7 +3981,7 @@ void MonitorStream::processCommand( const CmdMsg *msg )
 
     DataMsg status_msg;
     status_msg.msg_type = MSG_DATA_WATCH;
-    memcpy( &status_msg.msg_data, &status_data, sizeof(status_msg.msg_data) );
+    memcpy( &status_msg.msg_data, &status_data, sizeof(status_data) );
     int nbytes = 0;
     if ( (nbytes = sendto( sd, &status_msg, sizeof(status_msg), MSG_DONTWAIT, (sockaddr *)&rem_addr, sizeof(rem_addr) )) < 0 )
     {
-- 
2.5.0