Commit Graph

26983 Commits

Author SHA1 Message Date
IgorA100
62faabc5f0 When using ZMS, destroy VolumeSlider if it exists (MonitorStream.js) 2026-02-05 00:30:00 +03:00
IgorA100
534a9ef197 Fix: Eslint (MonitorStream.js) 2026-02-04 19:36:35 +03:00
IgorA100
85d5cbd63a Added the ability to retrieve tracks from a stream, disable Volume Controls if there is no audio track, and improved functionality for RTSP2Web, Janus, and ZMS. (MonitorStream.js) 2026-02-04 19:28:33 +03:00
IgorA100
1bfeb2512d Added "disabled" class to #volumeControls and ".audio-control-mute" (skin.css) 2026-02-04 16:52:24 +03:00
IgorA100
8714f295b7 IDs for #volumeControls, #volumeSlider, #controlMute now include the monitor ID (watch.php)
And also #volumeControls by default has the class "disabled"
2026-02-04 16:40:52 +03:00
Isaac Connor
ab1c333739 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-02-03 16:41:38 -05:00
Isaac Connor
7592fd933c Fix command injection vulnerability in image.php (CVE-2025-65791)
Add input validation and shell argument escaping to prevent OS command
injection via the 'show' parameter in web/views/image.php. The parameter
is now validated against an allowlist and all values passed to exec()
are wrapped with escapeshellarg().

Also fix PHP operator precedence bug in shutdown.php where 'and' was
used instead of '&&', causing the 'when' parameter validation to not
work as intended.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 16:39:38 -05:00
Isaac Connor
e1fced5a02 Add UTC vs local timezone offset detection and accomodation 2026-02-03 15:22:49 -05:00
Isaac Connor
bb7195204c fix: address multiple issues in SessionDescriptor::generateFormatContext
- Add null check for avformat_alloc_context() return value
- Add null checks for avformat_new_stream() and avcodec_alloc_context3()
- Fix copy-paste bug using smStaticPayloads instead of smDynamicPayloads
  when setting codec_name for dynamic payloads
- Fix memory leak by freeing codec_context after copying parameters

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 13:34:17 -05:00
Isaac Connor
32aed8a4aa fix: prevent division by zero in RtpSource::updateRtcpData
Guard against division by zero when calculating mRtpFactor if two
RTCP packets arrive with the same or very close NTP timestamps.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:47:14 -05:00
Isaac Connor
56453c4aee fix: correct type mismatches in RtpDataThread
- Change SSRC variable from unsigned long to uint32_t to match the
  struct definition (avoids inconsistent width on 64-bit platforms)
- Fix format specifier from %lx to %x to match uint32_t
- Change recv return type from int to ssize_t for correctness and
  consistency with zm_rtp_ctrl.cpp

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:45:56 -05:00
Isaac Connor
590640cefb fix: correct NTP timestamp type truncation in RtpCtrlThread
The NTP timestamp fields ntpSecN and ntpFracN are defined as uint32_t
in the RtcpPacket struct, but were being assigned to uint16_t local
variables, truncating the upper 16 bits.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:34:21 -05:00
Isaac Connor
68975a4db5 fix: add empty checks and use safer string functions in Storage
- Check if DIR_EVENTS is empty before accessing [0] to prevent UB
- Replace strcpy with strncpy for safer string copying

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:30:06 -05:00
Isaac Connor
f1122c2881 fix: add null checks in RtspThread to prevent crashes
- Check if response is empty before accessing response[0]
- Check if zmDbFetch result is null before using it

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:28:30 -05:00
Isaac Connor
978f6577de fix: check for empty path before accessing first character
Prevents undefined behavior when path string is empty by checking
path.empty() before accessing path[0].

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:25:21 -05:00
Isaac Connor
7caeedb2be fix: fix memory leaks in User::find() functions
Previously, if zmDbFetch returned a result but mysql_num_rows != 1,
the MYSQL_RES was not freed before returning nullptr, causing a
memory leak. Now properly frees the result in all code paths.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:24:07 -05:00
Isaac Connor
446b1a563b Define players for montage 2026-02-03 12:17:52 -05:00
Isaac Connor
ed6cb8de88 fix: call Stop() before restarting in PollThread::Start()
Prevents potential deadlock by ensuring any running thread is signaled
to terminate before joining, matching the pattern used in other thread
classes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:13:29 -05:00
Isaac Connor
f17d68cb3d Log when ondata is not defined 2026-02-03 12:11:32 -05:00
Isaac Connor
cf59a68128 Use starttime for inserting StartDateTime instead of NOW 2026-02-03 12:10:41 -05:00
Isaac Connor
bc2337d3c7 fix: fix typo, add null check, and use correct free function in VncCamera
- Fix typo: "GotFrameBufferUpdateallback" -> "GotFrameBufferUpdateCallback"
- Add null check after malloc in GetCredentialsCallback
- Use av_free() instead of free() in Close() since buffer was allocated
  with av_malloc()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:09:44 -05:00
Isaac Connor
f269d5ea85 fix: add null check before calling libvlc_media_player_stop in Terminate
Prevents potential crash if the function pointer or media player is null
(e.g., if library loading failed or PrimeCapture was not called).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:49:58 -05:00
Isaac Connor
ecb0ed4122 fix: return error when av_buffer_create fails in Image::PopulateFrame
Previously, when av_buffer_create() failed and returned nullptr, the code
only issued a Warning and continued, assigning the null pointer to the
frame buffer and returning success. Now properly returns -1 on failure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:48:03 -05:00
Isaac Connor
eea7d80416 fix: correct typo in Group warning message
Fix "MoniotorIds" -> "MonitorIds"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:42:14 -05:00
Isaac Connor
ced709b63c fix: correct error message and add null check in FifoStream
- Fix misleading error message: "reading" -> "writing" in sendMJEGFrames
- Add null check for monitor after Monitor::Load to prevent crash
  if monitor doesn't exist

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:36:53 -05:00
Isaac Connor
af12f46f98 fix: add null check and fix error message in FFmpeg_Output
- Add null check after avcodec_alloc_context3() to prevent null
  pointer dereference if allocation fails
- Fix misleading error message: "send packet" -> "receive frame"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:03:17 -05:00
Isaac Connor
88560a485f fix: remove unreachable code and prevent null dereference in FFmpeg_Input
- Remove unreachable return statement after continue
- Add null check for input_format_context in Close() to prevent
  dereference when using the alternative Open() overload

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:01:59 -05:00
Isaac Connor
65bbaa4ab8 fix: add null check and fix incomplete error message in FFmpegCamera
- Add null check after avformat_alloc_context() to prevent null pointer
  dereference if allocation fails
- Fix incomplete error message that was missing the path parameter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:00:38 -05:00
Isaac Connor
0217cfbab0 fix: correct misleading debug messages in zm_ffmpeg.cpp
Debug messages incorrectly used "!=" when describing matching conditions.
Changed to "==" to accurately reflect that the codec name/id matched.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:21:04 -05:00
Isaac Connor
df6c4a4a13 fix: address multiple bugs across core source files
- zm_analysis_thread.cpp, zm_decoder_thread.cpp: Fix potential deadlock
  in Start() by calling Stop() before joining thread
- zm_camera.cpp: Add null check after avformat_alloc_context()
- zm_comms.cpp: Fix memory leak in InetSocket::bind(), fix error message
  typo in deleteReader(), fix clearReaders/clearWriters to recalculate
  mMaxFd properly
- zm_config.cpp: Fix potential buffer underrun when parsing config files,
  fix misplaced SERVER_ID check logic
- zm_db.cpp: Fix logger level not restored on early return in zmDbDo(),
  fix empty string access in DB_HOST parsing
- zm_event.cpp: Fix typo "foudn" -> "found", fix memory leak with Tag
  allocation, fix variable shadowing with video_file
- zm_event_tag.cpp: Fix null dereference when AssignedBy is NULL
- zm_eventstream.cpp: Fix dangling pointer bugs with emplace_back
  (use auto& instead of auto), fix memory leak in loadInitialEventData

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:18:49 -05:00
Isaac Connor
cd3e2b5d1e fix: address bugs in videostore and stream
zm_videostore.cpp:
- Fix incorrect size passed to av_stream_add_side_data (was sizeof(int32_t),
  should be sizeof(int32_t)*9 for display matrix)
- Fix null pointer dereference of chosen_codec_data in PASSTHROUGH mode
  (use video_in_ctx->pix_fmt instead)

zm_stream.cpp:
- Fix logic error in last_crop initialization check (OR should be AND)
2026-02-02 23:26:20 -05:00
Isaac Connor
c6ab1c143b fix: address multiple bugs in eventstream, fifo, and monitor
zm_eventstream.cpp:
- Fix null pointer dereference when video_file or scheme column is NULL
- Fix out-of-bounds array access in CMD_SEEK handler when curr_frame_id
  decrements to 0
- Fix setStreamStart calling wrong loadInitialEventData overload (event_id
  was being truncated and used as monitor_id)

zm_fifo.cpp:
- Fix close(-1) call when file creation fails
- Fix use of uninitialized raw_fd when on_blocking_abort is false
- Reset outfile and raw_fd in close() to prevent use-after-close

zm_monitor.cpp:
- Fix shm_id being zeroed before use in shmctl() call
2026-02-02 23:24:08 -05:00
Isaac Connor
914b5b39c1 fix: correct User::Copy() and prevent nullptr dereference in token load
1. User::Copy() was copying monitor_permissions_loaded into
   group_permissions_loaded, should copy group_permissions_loaded.

2. zmLoadTokenUser() passed getenv() result directly to std::string
   constructor. If REMOTE_ADDR is not set, getenv() returns nullptr,
   and constructing std::string from nullptr is undefined behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:01:49 -05:00
Isaac Connor
4e0476603a fix: use errno instead of getsockopt return value for strerror
getsockopt() returns -1 on error, not an errno value. The actual error
code is stored in errno. Using strerror(retval) with retval=-1 gives
incorrect error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:56:04 -05:00
Isaac Connor
2f14c6559a fix: use mosquitto_strerror() for MQTT error codes
Mosquitto library functions return their own error codes (MOSQ_ERR_*),
not errno values. Using strerror() on these codes gives incorrect
error messages. Use mosquitto_strerror() which is designed for
Mosquitto error codes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:53:00 -05:00
Isaac Connor
4444491c66 fix: use errno instead of rename() return value for strerror
rename() returns -1 on error, not an errno value. The actual error
code is stored in errno. Using strerror(result) with result=-1 gives
incorrect error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:49:35 -05:00
Isaac Connor
2accb47324 fix: correct three bugs in config file parsing and ConfigItem
1. Double decrement in trailing whitespace removal loop caused skipping
   of characters. The post-decrement in *temp_ptr-- = '\0' already moves
   the pointer, so the extra temp_ptr-- was wrong.

2. ConfigItem copy constructor didn't copy cfg_type, cfg_value, or
   accessed from the source item, leaving them uninitialized.

3. ConfigItem::Copy() used delete instead of delete[] for arrays
   allocated with new[]. This is undefined behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:45:39 -05:00
Isaac Connor
c335b87749 fix: correct socket copy constructor and buffer overflow in recv
1. Socket copy constructor was copying from mLocalAddr/mRemoteAddr
   which were just initialized to nullptr, instead of from the source
   socket's addresses (socket.mLocalAddr/socket.mRemoteAddr).

2. Socket::recv() methods had buffer overflow: if recv() returned
   exactly buffer.size() bytes, writing the null terminator at
   buffer[nBytes] would be out of bounds. Allocate +1 for the
   terminator and limit recv to buffer.size()-1.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:44:01 -05:00
Isaac Connor
c9ab9815e6 fix: correct two bugs in socket/select handling
1. Socket::getBlocking() returned inverted logic. When O_NONBLOCK flag
   is set, the socket is non-blocking, so blocking should be false.
   The code returned true when O_NONBLOCK was set.

2. Select::wait() checked the wrong fd_set for writers. It checked
   &rfds (read fd_set) instead of &wfds (write fd_set), meaning
   writeable sockets were never properly detected.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:42:21 -05:00
Isaac Connor
dd4a055717 fix: move mVideoStreamId assignment inside null check
If avformat_new_stream() returns nullptr, the code would log an error
but then still dereference mVideoStream to get the index, causing a
null pointer dereference crash.

Move the assignment inside the if block where mVideoStream is known
to be valid.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:35:58 -05:00
Isaac Connor
2a25a47868 fix: prevent null pointer dereference in Buffer::tidy()
When a Buffer is created with the default constructor, mHead is nullptr.
If tidy() is called on an empty default-constructed buffer (e.g., via
consume(0)), the code would dereference nullptr at line 155:

  } else if (mSize == 0) {
    *mHead = '\0';  // CRASH: mHead is nullptr

Add a null check before dereferencing mHead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:34:33 -05:00
Isaac Connor
cbfa476d06 fix: initialize mosquittopp base class in initializer list
The MQTT constructor was incorrectly attempting to call the base class
constructor in the constructor body:

  mosquittopp(name.c_str());

This creates a temporary mosquittopp object that is immediately destroyed,
leaving the actual base class uninitialized. When connect() is subsequently
called, it uses methods from the uninitialized base class, causing a segfault.

Move the base class initialization to the member initializer list where it
belongs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:38:49 -05:00
Isaac Connor
ea0c79464c curl comes with baseos so let's remove the conflict by just using the base os verison 2026-02-02 14:24:52 -05:00
Isaac Connor
a33c9d2826 Increase ONVIF_Options column width to 255 characters
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 13:35:57 -05:00
Isaac Connor
dcfc669523 Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-02-02 13:07:23 -05:00
Isaac Connor
09d932a4f8 Update RtspServer for rpm builds 2026-02-02 13:07:20 -05:00
Isaac Connor
3c21eafeb6 Merge pull request #4586 from ZoneMinder/copilot/enable-tls-verification
Enable TLS certificate verification with fallback for camera connections
2026-02-02 13:03:24 -05:00
Isaac Connor
61e0915c36 Revert "Add --skip-broken to deal with continuing curl stupidity"
This reverts commit 6833e517a3.
2026-02-02 10:37:10 -05:00
copilot-swe-agent[bot]
27793980ef fix: Address code review feedback
- Add SSL verification state tracking to Dahua.pm to ensure retry logic works for all requests
- Add SSL retry logic to Dahua.pm sendCmd method
- Remove redundant 'use IO::Socket::SSL' statements from TapoC520WS_ONVIF.pm retry blocks

refs #TBD

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
2026-02-02 14:37:57 +00:00
copilot-swe-agent[bot]
3d8399bfab fix: Use numeric constant for CURLE_PEER_FAILED_VERIFICATION in PHP
The CURLE_PEER_FAILED_VERIFICATION constant may not be defined in all PHP curl versions. Use the numeric value (51) instead for better compatibility.

refs #TBD

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
2026-02-02 14:36:00 +00:00