1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Modified cSVDRP::CmdGRAB() to avoid writing into const data

This commit is contained in:
Klaus Schmidinger 2009-06-06 14:07:02 +02:00
parent 1d03f30e93
commit abd5a81c89
3 changed files with 10 additions and 6 deletions

View File

@ -921,6 +921,7 @@ Ludwig Nussel <ludwig.nussel@web.de>
for adding some missing 'const' keywords for adding some missing 'const' keywords
for pointing out that "%016llX" should be used instead of "%016LX" for pointing out that "%016llX" should be used instead of "%016LX"
for adding some missing 'const' keywords to avoid compilation errors with gcc 4.4 for adding some missing 'const' keywords to avoid compilation errors with gcc 4.4
for reporting that cSVDRP::CmdGRAB() writes into const data
Thomas Koch <tom@harhar.net> Thomas Koch <tom@harhar.net>
for his support in keeping the Premiere World channels up to date in 'channels.conf' for his support in keeping the Premiere World channels up to date in 'channels.conf'

View File

@ -6127,3 +6127,5 @@ Video Disk Recorder Revision History
Reinhard Nissl). Reinhard Nissl).
- Added some missing 'const' keywords to avoid compilation errors with gcc 4.4 - Added some missing 'const' keywords to avoid compilation errors with gcc 4.4
(thanks to Ville Skyttä and Ludwig Nussel). (thanks to Ville Skyttä and Ludwig Nussel).
- Modified cSVDRP::CmdGRAB() to avoid writing into const data (reported by
Ludwig Nussel).

13
svdrp.c
View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured * and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection. * graphical interface that sits on top of an SVDRP connection.
* *
* $Id: svdrp.c 2.4 2009/06/06 13:42:52 kls Exp $ * $Id: svdrp.c 2.5 2009/06/06 14:03:55 kls Exp $
*/ */
#include "svdrp.h" #include "svdrp.h"
@ -798,16 +798,17 @@ void cSVDRP::CmdGRAB(const char *Option)
char RealFileName[PATH_MAX]; char RealFileName[PATH_MAX];
if (FileName) { if (FileName) {
if (grabImageDir) { if (grabImageDir) {
cString s; cString s(FileName);
char *slash = strrchr(FileName, '/'); FileName = s;
const char *slash = strrchr(FileName, '/');
if (!slash) { if (!slash) {
s = AddDirectory(grabImageDir, FileName); s = AddDirectory(grabImageDir, FileName);
FileName = s; FileName = s;
} }
slash = strrchr(FileName, '/'); // there definitely is one slash = strrchr(FileName, '/'); // there definitely is one
*slash = 0; cString t(s);
char *r = realpath(FileName, RealFileName); t.Truncate(slash - FileName);
*slash = '/'; char *r = realpath(t, RealFileName);
if (!r) { if (!r) {
LOG_ERROR_STR(FileName); LOG_ERROR_STR(FileName);
Reply(501, "Invalid file name \"%s\"", FileName); Reply(501, "Invalid file name \"%s\"", FileName);