From: Samuel Ortiz Date: Tue, 10 Apr 2012 17:43:15 +0000 (+0200) Subject: NFC: Fix LLCP TLV building routine X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=324b0af6f5a48dc38dac016eed14d019cac5903f;p=openwrt%2Fstaging%2Fblogic.git NFC: Fix LLCP TLV building routine The if logic could lead to zero length TLVs. Signed-off-by: Samuel Ortiz Signed-off-by: John W. Linville --- diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c index 4aa52b8b6c0c..34ee6847806a 100644 --- a/net/nfc/llcp/commands.c +++ b/net/nfc/llcp/commands.c @@ -102,7 +102,7 @@ u8 *nfc_llcp_build_tlv(u8 type, u8 *value, u8 value_length, u8 *tlv_length) length = llcp_tlv_length[type]; if (length == 0 && value_length == 0) return NULL; - else + else if (length == 0) length = value_length; *tlv_length = 2 + length;