From c568200d2e6be95cd026b70c9ef532f72b1fc8a7 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 4 Nov 2007 11:24:07 +0100 Subject: Fixed decoding filename characters in case there are not two hex digits after the '#' --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ recording.c | 11 +++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 76572ef5..e49400a4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -588,6 +588,8 @@ Helmut Auer is a recording going on or about to start, and the user insists in shutting down now for suggesting to make the channel entry timeout configurable for a patch that was used to implement the SVDRP command REMO + for reporting a possible crash in decoding filename characters in case there are + not two hex digits after the '#' Jeremy Hall for fixing an incomplete initialization of the filter parameters in eit.c diff --git a/HISTORY b/HISTORY index 6270c7cc..6984bbd4 100644 --- a/HISTORY +++ b/HISTORY @@ -5516,3 +5516,5 @@ Video Disk Recorder Revision History of their Makefiles. - Fixed a crash if no fonts are found (thanks to Mario Ivankovits and Clemens Kirchgatterer). +- Fixed decoding filename characters in case there are not two hex digits after + the '#' (reported by Helmut Auer). diff --git a/recording.c b/recording.c index 51846114..7999f724 100644 --- a/recording.c +++ b/recording.c @@ -4,10 +4,11 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.156 2007/10/14 10:21:54 kls Exp $ + * $Id: recording.c 1.157 2007/11/04 11:17:43 kls Exp $ */ #include "recording.h" +#include #include #include #include @@ -448,12 +449,14 @@ char *ExchangeChars(char *s, bool ToFileSystem) case '/': *p = '~'; break; // encoded characters: case '#': { - if (strlen(p) > 2) { + if (strlen(p) > 2 && isxdigit(*(p + 1)) && isxdigit(*(p + 2))) { char buf[3]; sprintf(buf, "%c%c", *(p + 1), *(p + 2)); unsigned char c = strtol(buf, NULL, 16); - *p = c; - memmove(p + 1, p + 3, strlen(p) - 2); + if (c) { + *p = c; + memmove(p + 1, p + 3, strlen(p) - 2); + } } } break; -- cgit v1.2.3