From f305e7df37a6db7ff9f49e19d59c771e0119a69c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 18 Jun 2025 08:44:47 +0200 Subject: [PATCH] Fixed strreplace() in case the search string is empty --- CONTRIBUTORS | 1 + HISTORY | 3 ++- tools.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8f695e16..fb913a34 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3388,6 +3388,7 @@ Stefan Hofmann for reporting missing setting the file name of the info file after renaming a recording for adding '~' to the list of delimiters in cTextWrapper for suggesting to delete old recording info before reading modified info file + for fixing strreplace() in case the search string is empty Stefan Blochberger for suggesting to automatically display the progress display whenever replay of a diff --git a/HISTORY b/HISTORY index 419dfcf9..cd4022c4 100644 --- a/HISTORY +++ b/HISTORY @@ -10119,7 +10119,7 @@ Video Disk Recorder Revision History - Now deleting old recording info before reading modified info file (suggested by Stefan Hofmann). -2025-06-17: +2025-06-18: - Fixed some misplaced 'override' keywords in the 'hello' and 'skincurses' plugins. - cRecording now fetches priority, lifetime and framesPerSecond from cRecordingInfo. @@ -10129,3 +10129,4 @@ Video Disk Recorder Revision History - Updated the Italian OSD texts (thanks to Diego Pierotto). - Enabled manually turning subtitles on/off in 'after rewind' mode. - Limiting timeouts to a minimum of 3ms to avoid problems with polls and waits if timeout is 0. +- Fixed strreplace() in case the search string is empty (thanks to Stefan Hofmann). diff --git a/tools.c b/tools.c index 926f199d..76b1f0d6 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 5.16 2025/06/17 20:32:06 kls Exp $ + * $Id: tools.c 5.17 2025/06/18 08:44:47 kls Exp $ */ #include "tools.h" @@ -154,7 +154,7 @@ char *strreplace(char *s, char c1, char c2) char *strreplace(char *s, const char *s1, const char *s2) { - if (!s || !s1 || !s2 || strcmp(s1, s2) == 0) + if (!s || !s1 || !*s1 || !s2 || strcmp(s1, s2) == 0) return s; char *q = s; if (char *p = strstr(s, s1)) {