Fixed strreplace() to handle NULL strings

This commit is contained in:
Klaus Schmidinger 2021-01-02 15:05:48 +01:00
parent d2e0087c4e
commit 3211df30df
3 changed files with 9 additions and 1 deletions

View File

@ -3655,6 +3655,8 @@ J
for reporting a possible discrepancy of the primary device number in the LSTD and for reporting a possible discrepancy of the primary device number in the LSTD and
PRIM commands PRIM commands
for adding support for EAC3 audio from other sources for adding support for EAC3 audio from other sources
for reporting a crash if a pattern timer spawns a timer that uses EPISODE and the
event has no short text
Stefan Verse <Verse@amotronics.de> Stefan Verse <Verse@amotronics.de>
for fixing an occasional black screen when switching channels for fixing an occasional black screen when switching channels

View File

@ -9562,3 +9562,7 @@ Video Disk Recorder Revision History
- Fixed a compiler warning (thanks to Winfried Köhler). - Fixed a compiler warning (thanks to Winfried Köhler).
- Fixed convertCharacterTable() in case iconv_open() fails (thanks to Helmut Binder). - Fixed convertCharacterTable() in case iconv_open() fails (thanks to Helmut Binder).
- Official release. - Official release.
2021-01-02: Version 2.4.7
- Fixed strreplace() to handle NULL strings (reported by Jürgen Schneider).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.c 4.13 2020/11/22 13:32:05 kls Exp $ * $Id: tools.c 4.13.1.1 2021/01/02 15:05:48 kls Exp $
*/ */
#include "tools.h" #include "tools.h"
@ -151,6 +151,8 @@ char *strreplace(char *s, char c1, char c2)
char *strreplace(char *s, const char *s1, const char *s2) char *strreplace(char *s, const char *s1, const char *s2)
{ {
if (!s || !s1 || !s2)
return s;
char *p = strstr(s, s1); char *p = strstr(s, s1);
if (p) { if (p) {
int of = p - s; int of = p - s;