summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2009-06-06 14:07:02 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2009-06-06 14:07:02 +0200
commitabd5a81c897ae6b4c09b68742bf9f396155d1eb2 (patch)
tree592ef0e4cfd1ea2fb40a729442eb8dc0cb64e7b7 /svdrp.c
parent1d03f30e93194ef2cd27d613ed00409dbc54c95e (diff)
downloadvdr-abd5a81c897ae6b4c09b68742bf9f396155d1eb2.tar.gz
vdr-abd5a81c897ae6b4c09b68742bf9f396155d1eb2.tar.bz2
Modified cSVDRP::CmdGRAB() to avoid writing into const data
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/svdrp.c b/svdrp.c
index b417a8e1..416b8698 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* 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"
@@ -798,16 +798,17 @@ void cSVDRP::CmdGRAB(const char *Option)
char RealFileName[PATH_MAX];
if (FileName) {
if (grabImageDir) {
- cString s;
- char *slash = strrchr(FileName, '/');
+ cString s(FileName);
+ FileName = s;
+ const char *slash = strrchr(FileName, '/');
if (!slash) {
s = AddDirectory(grabImageDir, FileName);
FileName = s;
}
slash = strrchr(FileName, '/'); // there definitely is one
- *slash = 0;
- char *r = realpath(FileName, RealFileName);
- *slash = '/';
+ cString t(s);
+ t.Truncate(slash - FileName);
+ char *r = realpath(t, RealFileName);
if (!r) {
LOG_ERROR_STR(FileName);
Reply(501, "Invalid file name \"%s\"", FileName);