From 9c5cd5a188232b5de51af3fd2a3d0142cfde4923 Mon Sep 17 00:00:00 2001 From: hogliux Date: Thu, 24 Aug 2017 12:38:48 +0100 Subject: [PATCH] BLOCKS: Fixed a potential memory overflow in a recent commit --- .../topology/juce_PhysicalTopologySource.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp index b913258882..ae88a60ee6 100644 --- a/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp +++ b/modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp @@ -363,8 +363,13 @@ struct PhysicalTopologySource::Internal static bool versionNumberAddedToBlock (const juce::Array& devices, Block::UID uid, juce::String version) noexcept { for (auto&& d : devices) - if (d.uid == uid && memcmp (d.version.version, version.toRawUTF8(), d.version.length) != 0) + { + String deviceVersion (reinterpret_cast (d.version.version), + jmin (static_cast (d.version.length), sizeof (d.version.version))); + + if (d.uid == uid && deviceVersion != version) return true; + } return false; }