After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 447961 - [rtsp] do not store a reference to the result from inet_ntoa()
[rtsp] do not store a reference to the result from inet_ntoa()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal major
: 0.10.7
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-06-15 17:59 UTC by Peter Kjellerstedt
Modified: 2007-06-19 14:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Call g_strdup() on result from inet_ntoa() (754 bytes, patch)
2007-06-15 18:00 UTC, Peter Kjellerstedt
none Details | Review
improved patch (755 bytes, patch)
2007-06-17 16:54 UTC, Wim Taymans
none Details | Review

Description Peter Kjellerstedt 2007-06-15 17:59:02 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:
Comment 1 Peter Kjellerstedt 2007-06-15 18:00:25 UTC
Created attachment 90026 [details] [review]
Call g_strdup() on result from inet_ntoa()
Comment 2 Tim-Philipp Müller 2007-06-17 12:32:50 UTC
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.
Comment 3 Wim Taymans 2007-06-17 16:54:55 UTC
Created attachment 90151 [details] [review]
improved patch

since the reverse of _connect is _close, perform the _free in _close.
Comment 4 Jan Schmidt 2007-06-18 08:50:30 UTC
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?
Comment 5 Peter Kjellerstedt 2007-06-18 14:40:30 UTC
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)...
Comment 6 Jan Schmidt 2007-06-18 14:46:26 UTC
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.
Comment 7 Wim Taymans 2007-06-19 14:48:46 UTC
        * 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.