projects
/
platform
/
upstream
/
neard.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
32bd45a
)
handover: Try to send HS only if message preparation succeed
author
Szymon Janc
<szymon.janc@tieto.com>
Fri, 21 Sep 2012 14:48:30 +0000
(16:48 +0200)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Mon, 1 Oct 2012 08:16:52 +0000
(10:16 +0200)
near_ndef_prepare_handover_record can return NULL in message
preparation failed e.g. due to failure in requesting data from handover
agent. This could result in crash due to NULL pointer dereference.
plugins/handover.c
patch
|
blob
|
history
diff --git
a/plugins/handover.c
b/plugins/handover.c
index
642bf47
..
5d6c087
100644
(file)
--- a/
plugins/handover.c
+++ b/
plugins/handover.c
@@
-142,6
+142,10
@@
static int handover_ndef_parse(int client_fd, struct hr_ndef *ndef)
*/
msg = near_ndef_prepare_handover_record("Hs", records->data,
NEAR_CARRIER_BLUETOOTH);
+ if (msg == NULL) {
+ err = -EINVAL;
+ goto fail;
+ }
near_info("Send Hs frame");
err = send(client_fd, msg->data, msg->length, MSG_DONTWAIT);