vdr 1.3.25 thread problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Again:
The most beloved problem: Reentrancy...

This C-Function in tools.c looks suspicious:

cString TimeToString(time_t t)
{
  char buffer[32];
  if (ctime_r(&t, buffer)) {
     buffer[strlen(buffer) - 1] = 0; // strip trailing newline
     return buffer;
     }
  return "???";
}


It's usually no good idea to deference a variable on the stack
OUTSIDE the function it self..the next call to an other
functiom may overwrite the values!
It might work very often, but it is not really much better than a "static"!

Is there really no tool like "bounds checker for linux" 
that will warn at those obvious booby traps?



Having a deja vue:
I thought all that was "overworked" with the 
"thread-save" patches 3 month ago?

Or didn't these patches made the way into VDR?



The fastest fix may be:
Make it like in ctime_r an define a buffer pint as parameter.
The slowest: use the ugly time wasting asprintf and never forget 
to free the memory...




Rainer---<=====>                         Vertraulich
             //
           //                              
         <=====>--------------ocholl, Kiel, Germany ------------



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux