On 15.06.2011 19:37, Udo Richter wrote:
Am 15.06.2011 18:34, schrieb Klaus Schmidinger:
On 15.06.2011 15:30, Paul Menzel wrote:
            if (Instant&&   channel)
               snprintf(file, sizeof(file), "%s%s",
Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ?
Setup.NameInstantRecord : channel->Name());

...this should be

   sizeof(file) - 1

Actually, all versions of snprintf documentation I've just checked agree
that snprintf will write at most size-1 chars and a trailing 0 byte, so
it was ok before too. But for safety, on byte less doesn't hurt.

Gee, you're right!

Or is there some broken implementation out there that may write beyond

None that I know of.

Well, since the docs for snprintf are clear about this, let's
leave things as they are.

I wonder, though, why cppcheck thinks there's something wrong


vdr mailing list

Reply via email to