[vdr] vdr 1.7.16 no longer cleans del records from video.01, video.02...

Steffen Barszus steffenbpunkt at googlemail.com
Wed Oct 13 08:58:27 CEST 2010


On Tue, 12 Oct 2010 23:56:16 +0200
Klaus Schmidinger <Klaus.Schmidinger at tvdr.de> wrote:

> On 12.10.2010 17:50, Lou wrote:
> 
> The patch was originally suggested by "atinar" at
> 
>   http://www.vdr-portal.de/board/thread.php?postid=920661#post920661
> 
> and I adopted it with a suggestion from "Urig".
> Looks like nobody tested the patch in
> 
>   http://www.vdr-portal.de/board/thread.php?postid=936545#post936545
> 
> otherwise this malfunction might have been detected earlier ;-)
> 
> Unless "atinar" or somebody else comes up with a fixed version
> of this patch, I'll simply revert to the previous version.

Actually the only way the size of readlink() can
exceed the size of the filename, is if the encoding of the filename on
the linked-to directory is different, then the one of the original
file. Assuming UTF-8 has max 4 byte per character, int size =
strlen(buffer) * 4; should be fair enough. The length of the subtitle
should not matter, as the original filename should have the same
length as readlink if the encoding would be the same. 

If you don't want to make assumptions, i think this is the culprit:
+                             else if (n < size) {

as n is equal size (as we read the size before )

So this :
+                             else if (n < size) {
+                                l[n] = 0;
+                                dsyslog("removing %s", l);
+                                if (remove(l) < 0)
+                                   LOG_ERROR_STR(l);
+                                }
+                             else
+                                esyslog("ERROR: symlink name length
  (%d) exceeded anticipated buffer size (%d)", n, size);
+                             free(l);


should maybe be something like this:
+                             else {
+                                l[n] = 0;
+                                dsyslog("removing %s", l);
+                                if (remove(l) < 0)
+                                   LOG_ERROR_STR(l);
+                                }
+                             free(l);




More information about the vdr mailing list