Fix possible NULL pointer deference
Luiz Augusto von Dentz
maintainerPATCH 1/4 Fix possible NULL pointer deference
From: Luiz Augusto von Dentz <[email protected]>
Variable "os->driver" tracked as NULL.
--- src/obex.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
src/obex.c +3 -1
@@ -589,7 +589,9 @@ static int obex_read_stream(struct obex_session *os, obex_t *obex, os->buf =g_realloc (os->buf, os->pending + size);memcpy (os->buf + os->pending, buffer, size); os->pending += size; -if (os->object ==NULL ) { + +/* only write if both object and driver are valid */ +if (os->object ==NULL || os->driver ==NULL ) {DBG ("Stored %u bytes into temporary buffer" , os->pending);return 0 ; }
Signature · 1 line
1.7.1
Luiz Augusto von Dentz
maintainerPATCH 2/4 Fix possible NULL pointer deference
From: Luiz Augusto von Dentz <[email protected]>
Variable "transfer" tracked as NULL was passed to function "transfer_unregister" that dereferences it.
--- client/session.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
client/session.c +2 -4
@@ -1274,10 +1274,8 @@ int session_send(struct session_data *session, const char *filename, transfer =transfer_register (session, filename, targetname,NULL ,NULL ); -if (transfer ==NULL ) { - err = -EINVAL ; - goto fail; - } +if (transfer ==NULL ) +return -EINVAL ;/* Transfer should start if it is the first in the pending list */ if (transfer != session->pending->data)
Signature · 1 line
1.7.1
Hi Luiz,
Quoted 7 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Variable "transfer" tracked as NULL was passed to function "
transfer_unregister" that dereferences it.--- client/session.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
Pushed upstream. Thanks.
Johan
Luiz Augusto von Dentz
maintainerPATCH 3/4 Fix dead statement
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Cannot reach dead statement "(*os->driver->close)(object);"
--- src/obex.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
src/obex.c +1 -7
@@ -882,7 +882,7 @@ int obex_get_stream_start(struct obex_session *os, const char *filename) &size, &err);if (object ==NULL ) {error ("open(%s): %s (%d)" , filename,strerror (-err), -err); - goto fail; +return err; } os->object = object;
@@ -893,12 +893,6 @@ int obex_get_stream_start(struct obex_session *os, const char *filename) os->buf =g_malloc0 (os->tx_mtu);return 0 ; - -fail: -if (object) - os->driver->close (object); - -return err; }int obex_put_stream_start (struct obex_session *os,const char *filename)
Signature · 1 line
1.7.1
Re: [PATCH 3/4] Fix dead statement
Hi Luiz,
Quoted 6 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Cannot reach dead statement "(*os->driver->close)(object);"
--- src/obex.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
This one is also upstream.
Johan
Luiz Augusto von Dentz
maintainerPATCH 4/4 Fix possible use of uninitialized variables
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Using uninitialized value "hi" and "flags" in call to function "OBEX_ObjectAddHeader".
--- src/obex.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
src/obex.c +3 -0
@@ -670,6 +670,9 @@ add_header:case OBEX_HDR_APPARAM : flags =0 ;break ; +default : +error ("read(): unkown header type %u" , hi); +return -EIO ; }OBEX_ObjectAddHeader (obex, obj, hi, hd, len, flags);
Signature · 1 line
1.7.1
Re: [PATCH 4/4] Fix possible use of uninitialized variables
Hi Luiz,
Quoted 7 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Using uninitialized value "hi" and "flags" in call to function "
OBEX_ObjectAddHeader".--- src/obex.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
And this one has also been pushed upstream. Thanks.
Johan
Hi Luiz,
Quoted 6 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Variable "
os->driver" tracked as NULL.--- src/obex.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
Pushed upstream. Thanks.
Johan