From d9cff588be2dd17871a8c93577268373c7249fba Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Thu, 20 May 2010 18:04:06 -0300 Subject: [PATCH] obexd: Fix crash when receiving small objects When the received object fits in only one packet, when we reach obex_read_stream we may not have the driver. We must wait the driver to be set before writing. --- obexd/src/obex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obexd/src/obex.c b/obexd/src/obex.c index a39a48d36..38ff4388a 100644 --- a/obexd/src/obex.c +++ b/obexd/src/obex.c @@ -332,7 +332,8 @@ static int obex_read_stream(struct obex_session *os, obex_t *obex, if (os->size == OBJECT_SIZE_DELETE) os->size = OBJECT_SIZE_UNKNOWN; - if (os->pending > 0) + /* If there's something to write and we are able to write it */ + if (os->pending > 0 && os->driver) goto write; size = OBEX_ObjectReadStream(obex, obj, &buffer); -- 2.47.3