From 0f2399fd2165a7a77a685ff95738f19273e541ca Mon Sep 17 00:00:00 2001 From: skarg Date: Thu, 21 Jan 2016 17:35:40 +0000 Subject: [PATCH] =?UTF-8?q?BTL=20found=20the=20issue=20with=20proplist.c:?= =?UTF-8?q?=20When=20the=20number=20of=20required=20array=20elements=20are?= =?UTF-8?q?=20counted,=20the=203=20excluded=20mandatory=20properties=20are?= =?UTF-8?q?=20subtracted=20from=20=E2=80=9Dcount=E2=80=9D,=20but=20?= =?UTF-8?q?=E2=80=9Dcount=E2=80=9D=20is=20later=20overwritten,=20causing?= =?UTF-8?q?=20the=20encoded=20to=20miss=20the=20=E2=80=9Dcorrect=20by=203?= =?UTF-8?q?=E2=80=9D=20part=20of=20the=20code.=20-=20Thank=20you,=20Rasmus?= =?UTF-8?q?=20B.=20Nielsen!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bacnet-stack/src/proplist.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bacnet-stack/src/proplist.c b/bacnet-stack/src/proplist.c index 8a8b9586..8223588c 100644 --- a/bacnet-stack/src/proplist.c +++ b/bacnet-stack/src/proplist.c @@ -1175,16 +1175,14 @@ int property_list_encode( unsigned i = 0; /* loop index */ required_count = property_list_count(pListRequired); - if (required_count >= 3) { - /* less the 3 always required properties */ - count -= 3; - } else { - count = 0; - } optional_count = property_list_count(pListOptional); proprietary_count = property_list_count(pListProprietary); /* total of all counts */ count = required_count + optional_count + proprietary_count; + if (required_count >= 3) { + /* less the 3 always required properties */ + count -= 3; + } if ((rpdata == NULL) || (rpdata->application_data == NULL) || (rpdata->application_data_len == 0)) { return 0;