Skip to content

Commit

Permalink
Fix potential string over-read in mythraopconnection.
Browse files Browse the repository at this point in the history
Recent changes to Qt6 or the compiler have produced new compiler
warnings.  In this case the compiler thinks it is trying to copy six
bytes from an empty QByteArray.  Add a length check to ensure that the
are enough bytes in the copy source.
  • Loading branch information
linuxdude42 committed Jul 18, 2023
1 parent 87532d6 commit 32b165c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp
Expand Up @@ -1081,8 +1081,17 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header,
i += 16;
}
}
memcpy(&from[i], m_hardwareId.constData(), AIRPLAY_HARDWARE_ID_SIZE);
i += AIRPLAY_HARDWARE_ID_SIZE;
if (m_hardwareId.size() == AIRPLAY_HARDWARE_ID_SIZE)
{
memcpy(&from[i], m_hardwareId.constData(), AIRPLAY_HARDWARE_ID_SIZE);
i += AIRPLAY_HARDWARE_ID_SIZE;
}
else
{
LOG(VB_PLAYBACK, LOG_ERR, LOC +
QString("Hardware MAC address size %1, expected %2")
.arg(m_hardwareId.size()).arg(AIRPLAY_HARDWARE_ID_SIZE));
}

int pad = 32 - i;
if (pad > 0)
Expand Down

0 comments on commit 32b165c

Please sign in to comment.