Commit Graph

3682 Commits

Author SHA1 Message Date
Steve Karg 5802bd0ecc Fixed CreateObject service list-of-initial-values encoding and decoding. (#1199)
Fixes the CreateObject service list-of-initial-values encoding and decoding by refactoring the data structure to be similar to WriteProperty. The implementation changes from using a linked list of property values to using a flat buffer approach with delayed decoding.

Changes:

* Refactored BACNET_CREATE_OBJECT_DATA structure to use an application_data buffer instead of a linked list for initial values
* Added a new create_object_process() and create_object_initializer_list_process() functions to centralize object creation logic and error reporting
* Updated all device implementations to use the new centralized creation functions
* Enhanced the create-object example application to support command-line specification of initial property values
* Added comprehensive test coverage for the new encoding/decoding and processing functions
2026-01-15 14:50:59 -06:00
Steve Karg 21daea9eb4 Added device WriteProperty callbacks for Timer object in example device objects implementations. (#1203) 2026-01-15 10:15:22 -06:00
Steve Karg 8aabe883e9 Changed RGB color clamp function to avoid Zephyr RTOS name collisions. (#1201) 2026-01-12 07:29:40 -06:00
Steve Karg c5dc00a77b Bugfix/validate-user-provided-file-object-paths (#1197)
* Fixed BACnet file object path name unintended path traversals by optionally restricting path name content with BACNET_FILE_PATH_RESTRICTED define.

* Added POSIX file path name checking for AtomicReadFile and AtomicWriteFile example applications. Prohibits use of relative and absolute file paths when BACNET_FILE_PATH_RESTRICTED is non-zero.
2026-01-05 11:19:52 -06:00
Steve Karg 715e45eb5c Changed version to 1.5.0.rc3 for security fix tracking in branch. 2026-01-04 08:08:08 -06:00
Steve Karg 4e1176394a Bugfix/ubasic-string-tokenizer-null-termination (#1196)
* Fixed tokenizer_string() off-by-one buffer overflow when processing string literals longer than the buffer limit.

* Fixed ubasic potential string buffer overflows by using snprintf instead of sprintf.

* Fixed ubasic label strings to use UBASIC_LABEL_LEN_MAX as buffer limit.

* Fixed ubasic string variables to initialize with zeros.

* Fixed compile errors when UBASIC_DEBUG_STRINGVARIABLES is defined.

* Added ubasic string variables user accessor API and unit testing for ubasic string variables.

* Fixed tokenizer_label() off-by-one buffer overflow when processing string literals longer than the buffer limit.
2026-01-03 15:11:34 -06:00
Steve Karg d40188a8ec Updated doc/README.developer with some path name and helpful info 2026-01-02 10:00:12 -06:00
Steve Karg ed581d1bfa Updated doc/README.todo with in-progress items. 2026-01-02 09:06:18 -06:00
Patrick Grimm a15ec5eac4 Fixed linux compile with musl (#1194)
missing include asm/ioctls.h with error 'TCGETS2' undeclared

The gcc warning "overflow in conversion from 'long unsigned int' to 'int' changes value from '2150388778' to '-2144578518' " can be surrpres wtith a musl patch
https://gist.github.com/stargieg/3dbfe94b5776d9dfb3e14d18ee43aade

from the musl mailing list with discussion on this bug, but no solution.
[PATCH] ioctl: Fix implicit constant conversion overflow
https://www.openwall.com/lists/musl/2024/06/01/1
2025-12-26 07:40:27 -06:00
Patrick Grimm 2f6132b13e Fix mstp on bsd port (#1193)
* fix mstp on macos NS_PER_S is 1s and 0ns

* fix compile on freebsd

* port bsd: add compile warnings and comments

* port bsd: limit pthred prio to OS defined min/max value
e.g. FreeBSD min=0 max=31

* port bsd: fix clangformat
2025-12-24 18:50:29 -06:00
Steve Karg 88abd3a488 Fixed lighting-output object blink warn relinquish. (#1192)
* Fixed lighting-output object blink warn to honor blink-warn-enable.

* Fixed the blink warn logic for a non-zero percent value blink inhibit.

* Fixed the warn relinquish to actually relinquish.
2025-12-18 16:25:52 -06:00
Steve Karg 5a9abde528 Fixed channel-value encoding in the channel object when no-coercian is required for lighting-command, color-command, and xy-color. (#1190) 2025-12-18 11:08:28 -06:00
Steve Karg 390711a604 Changed the load control object AbleToMeetShed to only check immediate, and added CanNowComplyWithShed function to attempt to meet the shed request while in the non-compliant state. (#1191) 2025-12-18 11:08:03 -06:00
Steve Karg df335343f3 Added test for shed type amount. 2025-12-15 16:16:51 -06:00
Steve Karg 37e45bbb6a Added test for shed type percent. 2025-12-15 15:59:56 -06:00
Steve Karg e7371b16a3 Extended load-control object unit test validation code coverage. 2025-12-15 14:35:08 -06:00
Steve Karg 2c3c1c7bb8 Fixed NULL handling in CharacterString sprintf which caused endless loop. (#1189) 2025-12-13 11:50:22 -06:00
Steve Karg b8bf498e57 Updated SECUTITY after CVE reported on 1.5.0.rc1 2025-12-13 11:27:55 -06:00
Ryan Mulder 602111059a Add support for Event_Message_Texts and Fault Event Notifications in Analog Input objects (#1188) 2025-12-12 22:44:44 -06:00
Steve Karg 380540635c Refactored BACnetShedLevel encoding, decoding, and printing into separate file. Added unit testing. (#1187)
* Refactored BACnetShedLevel encoding, decoding, and printing into separate file.  Added unit testing.

* Added API to load control object for shed-level, start-time, duty-window, full-duty-baseline, and enable.

* Fixed bacapp sprintf for shed level and host-n-port found in scan build.
2025-12-12 08:32:42 -06:00
Steve Karg 7a319c2901 Updated CHANGELOG for recent changes. 2025-12-11 14:58:18 -06:00
Ryan Mulder 731e1b8370 implemented Analog_Input_Notification_Class, Analog_Input_Event_Enable, Analog_Input_Notify_Type (#1184) 2025-12-11 14:56:41 -06:00
Steve Karg 4b9cd061e7 Added API and properties to basic lighting output object example for power and feedback value. (#1185) 2025-12-11 13:33:50 -06:00
Steve Karg e0ce0bd5c7 Disabled macOS workflow that is taking forever. (#1186) 2025-12-11 13:03:51 -06:00
Steve Karg 2e973fac93 Updated CHANGELOG for recent changes. 2025-12-09 13:22:42 -06:00
Steve Karg 7f2690fd96 Fixed a regression in the rpm_ack_object_property_process() function that prevented proper parsing of multi-object ReadPropertyMultiple ACK responses. The bug was introduced in PR #765 and caused the function to incorrectly return ERROR_CODE_INVALID_TAG after processing the first object, even when additional valid objects were present in the response. Added tests that use rpm_ack_object_property_process() with a multi-object RPM ACK to verify the fix and prevent regression. (#1183) 2025-12-09 13:18:52 -06:00
Steve Karg 2b328266c8 Fixed Channel object coercion encoding of non-primitive data. (#1181)
* Refactored the object-id to and from 32-bit value so channel-value could re-use the same API.

* Expanded the BACnetChannelValue coercion function to include all the coercions, no coercions, and invalid datatypes described in Table 12-63 of the Channel object.  Expanded unit testing code coverage for BACnetChannelValue.
2025-12-09 11:02:58 -06:00
Steve Karg 95cdec459e Fix warnings during unit testing of BACnet secure connect node. (#1182) 2025-12-09 09:34:28 -06:00
Steve Karg b1c6a0e74b Fixed writing to the Channel object when no member value coercion was required. (#1176)
* Updated documentation for encode functions to accurately describe return values (0 on error instead of BACNET_STATUS_ERROR)

* Expanded property support, removed INPUT object types, added fallback encoding for non-coerced data types, and updated error handling in ReadProperty of present-value to check for 0 instead of BACNET_STATUS_ERROR.

* Expanded the validation tests and increased test code coverage.
2025-12-04 20:28:43 -06:00
Steve Karg 5758e511c8 Bump release candidate version to rc2 2025-12-04 09:42:25 -06:00
Steve Karg 9378f7d1e7 Secured npdu_is_expected_reply() function where the MS/TP reply matcher could have an out-of-bounds read. (#1178) 2025-12-04 09:34:20 -06:00
Steve Karg 11efd6902c Integrated the Loop object read/write references and manipulated variables with device read/write property in basic example device object. (#1175) 2025-12-03 16:23:01 -06:00
Steve Karg 63e984edbb Updated CHANGELOG for recent changes. 2025-12-03 16:12:26 -06:00
Ryan Mulder 9a335b545e Added _Address versions of a few services, primarily for interacting with MS/TP slaves (#1174)
* add address versions of Send_Write_Property_Request and Send_Read_Property_Multiple_Request

* add Send_COV_Subscribe_Address
2025-12-03 16:05:26 -06:00
Steve Karg 6993a7c0fd Bugfix/indtext-find-string-among-similar (#1173)
* Enhanced string comparison functions and update indtext API usage

- Added library specific case-sensitive and case-insensitive string comparison functions that mimic strcmp.
- Updated indtext_by_string and indtext_by_istring to use the new comparison functions.
- Improved documentation for return values in indtext functions.
- Expanded test data in main.c for comprehensive testing when beginning of string matches another string.
2025-12-03 11:08:32 -06:00
Ryan Mulder 458508f562 increase size of MAX_HEADER in BACDL_MULTIPLE because 8 is not big enough for some datalinks (e.g. mstp) (#1170) 2025-12-03 11:01:18 -06:00
Ryan Mulder 19cd0e8cd8 Add npdu set i am router to network handler (#1169)
* added npdu_set_i_am_router_to_network_handler

* npdu_send_what_is_network_number: fix sending to broadcast address
2025-12-03 11:00:28 -06:00
Ryan Mulder 0fd814867d Change prints to debug (#1168) 2025-12-03 10:59:30 -06:00
Steve Karg b1c9d013ef Fixed compiler macro redefined warning when optional datatypes are defined globally. (#1172) 2025-12-03 08:58:36 -06:00
Steve Karg 8991c56b70 Fixed copy and compare API of BACnetObjectPropertyReference structure. (#1171) 2025-12-02 16:54:10 -06:00
Steve Karg e7f1101808 Fixed array-bounds on BACnetObjectPropertyReference parsing. (#1167) 2025-12-02 15:04:45 -06:00
Steve Karg bdfe70639c Fixed the missing BACnetObjectPropertyReference text used in debugging. Also fixed missing BACnetSCFailedConnectionRequest, BACnetSCHubFunctionConnection, BACnetSCDirectConnection,BACnetSCHubConnection, BACnetTimerStateChangeValue, and BACnetAddressBinding text. (#1166) 2025-12-02 14:31:19 -06:00
Steve Karg c33944e0f8 Fixed the units to/from ASCII to function for other units properties. (#1165) 2025-12-02 12:37:27 -06:00
Steve Karg cef68dc079 Feature/refactor-apps-string-parsing (#1152)
* Added bacnet_str functions for parsing various numeric strings.

* Renamed BACnet string API to be clearer when no stdlib function exists.

* Fixed  incompatible types - from 'BACNET_UNSIGNED_INTEGER *' to 'unsigned long *'  warning

* Changed bacnet-str-to functions to use ERANGE for error detection.

* Refactored some apps to use common string parsing for BACnet data types.

* Refactor bacapp_parse_application_data to use bacnet_string_to_unsigned for better clarity

* Added strtol for BACnetEventType.
2025-12-02 11:27:19 -06:00
Steve Karg 73fbb400cb Fixed bacnet_snprintf() to be able to return the full length of a string when the size is zero. (#1164) 2025-12-01 13:45:30 -06:00
matt7aylor f28c804969 Fixed ipv6 destination port and multicast interface issues. (#1161) 2025-11-27 23:14:35 -06:00
Steve Karg ca9836b099 Added BACnetRecipient and BACnetAddressBinding codecs for EPICS application (#1163)
* Added BACnetRecipient and BACnetAddressBinding encoding, decoding, ASCII conversion, comparison, and copy functions.

*  Added library specific string manipulation utilities including strcmp, strncmp, stptok, and snprintf with offset functions.

* Added test/README about verification and validation testing.
2025-11-27 23:12:39 -06:00
Steve Karg 21626d1ac5 Fixed datetime integer overflow on 8-bit compiler (#1162) 2025-11-25 21:02:04 -06:00
Steve Karg ba2e2ac24f Added default option to some bactext name functions so that NULL can be returned when a name does not exist. (#1160) 2025-11-21 17:19:10 -06:00
Steve Karg a31261f78d Moved ltrim, rtrim, and trim string functions into the bacstr library. (#1159) 2025-11-21 16:30:40 -06:00