From 4b87d100d09acbbc9e5b6a2fe4a6a04d5d39740e Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Thu, 5 Dec 2013 15:03:46 +0900 Subject: [PATCH] nfc: arrange source codes Removed unused variables. Added checking data size. Change-Id: Ib3b818ce35733345ccdb281a5292a76a1dd160e6 Signed-off-by: munkyu.im --- tizen/src/hw/maru_virtio_nfc.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tizen/src/hw/maru_virtio_nfc.c b/tizen/src/hw/maru_virtio_nfc.c index 3dc2120a6d..e4bf3f4c10 100644 --- a/tizen/src/hw/maru_virtio_nfc.c +++ b/tizen/src/hw/maru_virtio_nfc.c @@ -58,21 +58,11 @@ typedef struct MsgInfo static QTAILQ_HEAD(MsgInfoRecvHead , MsgInfo) nfc_recv_msg_queue = QTAILQ_HEAD_INITIALIZER(nfc_recv_msg_queue); - -static QTAILQ_HEAD(MsgInfoSendHead , MsgInfo) nfc_send_msg_queue = -QTAILQ_HEAD_INITIALIZER(nfc_send_msg_queue); - - -// - typedef struct NFCBuf { VirtQueueElement elem; QTAILQ_ENTRY(NFCBuf) next; } NFCBuf; -static QTAILQ_HEAD(NFCMsgHead , NFCBuf) nfc_in_queue = -QTAILQ_HEAD_INITIALIZER(nfc_in_queue); - static pthread_mutex_t recv_buf_mutex = PTHREAD_MUTEX_INITIALIZER; bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const uint32_t len) @@ -87,6 +77,11 @@ bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const u return false; } + if(len > MAX_BUF_SIZE) { + ERR("the length of data is longer than max buffer size"); + return false; + } + memset(&_msg->info, 0, sizeof(nfc_msg_info)); memcpy(_msg->info.buf, data, len); -- 2.34.1