diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2007-11-04 11:24:07 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2007-11-04 11:24:07 +0100 |
commit | c568200d2e6be95cd026b70c9ef532f72b1fc8a7 (patch) | |
tree | b3c73f52563b7759f47a969f9a0e9a900747689f /recording.c | |
parent | c01249ffe5ef1a98e309f5857ba8724f59163391 (diff) | |
download | vdr-c568200d2e6be95cd026b70c9ef532f72b1fc8a7.tar.gz vdr-c568200d2e6be95cd026b70c9ef532f72b1fc8a7.tar.bz2 |
Fixed decoding filename characters in case there are not two hex digits after the '#'1.5.11
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 11 |
1 files changed, 7 insertions, 4 deletions
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 <ctype.h> #include <dirent.h> #include <errno.h> #include <fcntl.h> @@ -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; |