Fixed a crash in the SVDRP command CLRE in case a non-existing channel number is given

This commit is contained in:
Klaus Schmidinger 2021-01-02 15:18:06 +01:00
parent 9f4c5cd785
commit 5f1e08f606
3 changed files with 9 additions and 3 deletions

View File

@ -2938,6 +2938,8 @@ Manuel Reimer <Manuel.Reimer@gmx.de>
for reporting a bug in moving channels between number groups in SVDRP's MOVC command
for fixing compatibility with current versions of glibc
for suggesting to make the SVDRP command DELC accept a channel id
for reporting a crash in the SVDRP command CLRE in case a non-existing channel
number is given
Rene van den Braken <rene@vandenbraken.name>
for reporting a bug in writing the PCR pid into the PMT in

View File

@ -9568,3 +9568,5 @@ Video Disk Recorder Revision History
- Fixed strreplace() to handle NULL strings (reported by Jürgen Schneider).
- Somewhere down the road the 'x' bit of Doxyfile.filter got lost, so the
Makefile now makes sure it is set before calling doxygen.
- Fixed a crash in the SVDRP command CLRE in case a non-existing channel number is
given (reported by Manuel Reimer).

View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
* $Id: svdrp.c 4.43 2020/06/22 20:59:49 kls Exp $
* $Id: svdrp.c 4.43.1.1 2021/01/02 15:18:06 kls Exp $
*/
#include "svdrp.h"
@ -1301,8 +1301,10 @@ void cSVDRPServer::CmdCLRE(const char *Option)
tChannelID ChannelID = tChannelID::InvalidID;
if (isnumber(Option)) {
int o = strtol(Option, NULL, 10);
if (o >= 1 && o <= cChannels::MaxNumber())
ChannelID = Channels->GetByNumber(o)->GetChannelID();
if (o >= 1 && o <= cChannels::MaxNumber()) {
if (const cChannel *Channel = Channels->GetByNumber(o))
ChannelID = Channel->GetChannelID();
}
}
else {
ChannelID = tChannelID::FromString(Option);