]> git.sur5r.net Git - bacula/bacula/commitdiff
Avoid problem when stripping a relative path
authorEric Bollengier <eric@baculasystems.com>
Tue, 28 Aug 2012 09:39:12 +0000 (11:39 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:51:01 +0000 (14:51 +0200)
bacula/src/filed/backup.c

index 44d7e29d5c773d2b5c200cb5c98cca586d33bf1f..3a42799eb969c8a0e0e83ab685edb789adabe557 100644 (file)
@@ -1440,8 +1440,10 @@ static bool do_strip(int count, char *in)
    while (*in && !IsPathSeparator(*in)) {    
       out++; in++;
    }
-   out++; in++;
-   numsep++;                     /* one separator seen */
+   if (*in) {                    /* Not at the end of the string */
+      out++; in++;
+      numsep++;                  /* one separator seen */
+   }
    for (stripped=0; stripped<count && *in; stripped++) {
       while (*in && !IsPathSeparator(*in)) {
          in++;                   /* skip chars */