Mailing List archive

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

[linux-dvb] Dangerous mix between C++ strings and C char arrays



In all the source files in the folder DVB/apps/tuxzap I can see things
like :
char path[256];
ostringstream str(string(path,256));
Then the author initializes the string `str' correctly and after that
he uses the pointer `path'. This is wrong, because in the current
implementation of the STL string() makes a copy of `path', so the
variables `str' and `path' don't share the same buffer.
In result I can successfully compile the applications
{r,n,}tux{player,view,zap} but they aren't working and I can see a lot
of random characters instead of the messages.
I think it's better if the author corrects the bugs himself, but if
you ask me I can make a patch by adding some strncpy() when needed.

--
Nicolas Baradakis

--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index