Fixed decoding filename characters in case there are not two hex digits after the '#'

This commit is contained in:
Klaus Schmidinger 2007-11-04 11:24:07 +01:00
parent c01249ffe5
commit c568200d2e
3 changed files with 11 additions and 4 deletions

View File

@ -588,6 +588,8 @@ Helmut Auer <vdr@helmutauer.de>
is a recording going on or about to start, and the user insists in shutting down now 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 suggesting to make the channel entry timeout configurable
for a patch that was used to implement the SVDRP command REMO 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 <jhall@UU.NET> Jeremy Hall <jhall@UU.NET>
for fixing an incomplete initialization of the filter parameters in eit.c for fixing an incomplete initialization of the filter parameters in eit.c

View File

@ -5516,3 +5516,5 @@ Video Disk Recorder Revision History
of their Makefiles. of their Makefiles.
- Fixed a crash if no fonts are found (thanks to Mario Ivankovits and Clemens - Fixed a crash if no fonts are found (thanks to Mario Ivankovits and Clemens
Kirchgatterer). Kirchgatterer).
- Fixed decoding filename characters in case there are not two hex digits after
the '#' (reported by Helmut Auer).

View File

@ -4,10 +4,11 @@
* 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: 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 "recording.h"
#include <ctype.h>
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -448,12 +449,14 @@ char *ExchangeChars(char *s, bool ToFileSystem)
case '/': *p = '~'; break; case '/': *p = '~'; break;
// encoded characters: // encoded characters:
case '#': { case '#': {
if (strlen(p) > 2) { if (strlen(p) > 2 && isxdigit(*(p + 1)) && isxdigit(*(p + 2))) {
char buf[3]; char buf[3];
sprintf(buf, "%c%c", *(p + 1), *(p + 2)); sprintf(buf, "%c%c", *(p + 1), *(p + 2));
unsigned char c = strtol(buf, NULL, 16); unsigned char c = strtol(buf, NULL, 16);
*p = c; if (c) {
memmove(p + 1, p + 3, strlen(p) - 2); *p = c;
memmove(p + 1, p + 3, strlen(p) - 2);
}
} }
} }
break; break;