- Fixes errno overwrite in sdp_connect().
PATCH 2/2 - Fixes errno overwrite in sdp_connect().
If bind() fails (or connect() in the do-while() fails with EBUSY), the 'errno' contents will be overwritten in the 'fail' label.
src/sdp.c | 3 +++ 1 files changed, 3 insertions(+)
src/sdp.c +3 -0
@@ -3160,6 +3160,7 @@ static inline int sdp_is_local(const bdasdp_session_t *sdp_connect (const bdaddr_t *src,const bdaddr_t *dst,uint32_t flags) { +int err;sdp_session_t *session =malloc (sizeof (sdp_session_t));if (!session)return session;
@@ -3204,8 +3205,10 @@ sdp_session_t *sdp_connect(const bdaddr_ } } fail: + err = errno;if (session->sock >=0 )close (session->sock);free (session); + errno = err;return 0 ; }