GNOME Bugzilla – Bug 447961
[rtsp] do not store a reference to the result from inet_ntoa()
Last modified: 2007-06-19 14:48:46 UTC
Please describe the problem: It is a bad idea to store a reference in an RTSPConnection to a result from inet_ntoa() since it uses a static buffer... Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 90026 [details] [review] Call g_strdup() on result from inet_ntoa()
Nice catch, not sure if this is a blocker for the release though. Marking as such for now, something for the release manager to decide.
Created attachment 90151 [details] [review] improved patch since the reverse of _connect is _close, perform the _free in _close.
I think it's ok to punt this. Is strdup the right solution though - isn't there a reentrant variant of inet_ntoa, or is it using thread-local storage for the static buffer in glibc?
Well, the alternative is a fixed size buffer within RTSPConnection, which also would be viable. In that case inet_ntop() is probably the right solution. Actually I think inet_ntop() should be used either way to be able to support IPv6 (which probably requires more changes throughout the RTSP code)...
Yep, I think inet_ntop is a more general solution. Either way though, I'm going to release the current code today unless someone really thinks that's a bad idea and explains why.
* gst/rtsp/rtspconnection.c: (rtsp_connection_connect), (rtsp_connection_close), (rtsp_connection_free): Use threadsafe inet_ntop to convert an ip number to a string. Fixes #447961. Don't leak fd (and ip) when freeing a connection without first closing it.