Commit Graph

3709 Commits

Author SHA1 Message Date
Steve Karg 576cac784e Fixed compile warning in bacnet_strtof() from double fabs() to float FLT_MAX by using same pattern as Channel and Timer objects for float range validation. 2026-02-10 14:05:50 -06:00
Steve Karg a4ba359fde Add writable properties test for CreateObject service when used as backup-restore file format. 2026-02-10 07:49:31 -06:00
Steve Karg 7e13980899 Updated CHANGELOG for recent changes. 2026-02-09 16:25:50 -06:00
Steve Karg 20ffb81d2f Add conditional check for object creation in create_object_process 2026-02-09 16:14:43 -06:00
Steve Karg 8b2a40b9be Fixed basic Load Control object example WritableProperties list. 2026-02-09 16:07:23 -06:00
Steve Karg 548acfe563 Fix loop condition in server example app during object creation in Init_Service_Handlers. 2026-02-09 16:07:13 -06:00
Steve Karg 145d026224 Added BACnet file object restore using CreateObject handling after a backup for the STARTRESTORE state. 2026-02-09 16:07:04 -06:00
Steve Karg 45ed68e8b8 Added bacfile_read_offset() API to read offsets into a file during a restore after a backup. 2026-02-09 16:06:54 -06:00
Steve Karg 0f325b1529 Added CreateObject continue-on-error flag to be able to use for restoring a backup when object exists or object doesn't support dynamic creation. 2026-02-09 16:06:42 -06:00
Steve Karg 420c74635c Updated CHANGELOG for recent pull-request. 2026-02-06 21:05:54 -06:00
xiang33 741748f929 Fix stack buffer overflow in Schedule_Weekly_Schedule_Set (#1222)
* Fix stack buffer overflow in Schedule_Weekly_Schedule_Set

The memcpy was using sizeof(BACNET_WEEKLY_SCHEDULE) instead of
sizeof(BACNET_DAILY_SCHEDULE), causing it to read 6784 bytes from
a 968-byte source buffer, leading to stack buffer overflow and
segmentation fault in the test_schedule unit test.

This fixes the test_schedule test failure detected by ASAN:
ERROR: AddressSanitizer: stack-buffer-overflow on address ...
READ of size 6784 at 0x... partially underflows this variable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update src/bacnet/basic/object/schedule.c

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: kent.liu <kent.liu@designlibro.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Steve Karg <steve@kargs.net>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-06 21:01:44 -06:00
Steve Karg 1d1cf9bfac Feature/create object initial value backup (#1223)
* Added example Device object and property value backup using create-object list-of-initial-values and writable properties. Initiated using ReinitializeDevice with STARTBACKUP command. Added backup and restore required properties to the Device object.

* Fixed fwrite parameters in bacfile_posix_write_stream_data to return the correct number of bytes written.

* Added Device Management-Backup and Restore-B (DM-BR-B) conversion to Wireshark PCAP format command line utility in apps/dmbrcap which decodes and provides a view of the binary backup file.
2026-02-06 16:54:10 -06:00
Steve Karg 94e79efead Bugfix/example-app-uevent-event-parsing (#1221)
* Added Send_UEvent_Notify_Device function for device-specific unconfirmed event notifications.

* Fixed event_notify_parse() loop index to start from zero.

* Added device ID binding support in the UEvent command-line application.

* Fixed the UEvent command-line application help output.

* Fixed initialization of event data in the UEvent command-line application by adding static CharacterString for message text and handling the failure case.
2026-02-05 13:41:56 -06:00
Steve Karg edff06a9c0 Fix You-Are-Request encoding and decoding to use object-id instead of unsigned. (#1220) 2026-02-05 08:10:45 -06:00
Steve Karg 8cd1d82d81 Add segmentation support functions (#1218)
* Added segmentation support functions and example changes, but no support for segmentation in the TSM or APDU handlers.
2026-02-04 17:03:13 -06:00
Steve Karg 577ecf8d7f Added handling for abort and reject errors in Write Property service (#1216) 2026-02-02 13:54:26 -06:00
Steve Karg 59218819c1 Added end-of-blink callback for warn-off and warn-relinquish lighting commands (#1214)
* Added Blink.Callback and Blink.Priority to support end-of-blink actions for WARN_OFF/WARN_RELINQUISH. The Blink.Callback is invoked when a blink sequence ends or when a new command interrupts a WARN_OFF/WARN_RELINQUISH in progress.

* Added Lighting Output (LO) WARN_OFF/WARN_RELINQUISH post-egress priority array handling using the Blink.Callback
2026-01-29 16:03:55 -06:00
Ryan Mulder 503472fdb5 fix spelling of BACfile_Writable_Property_List (#1213) 2026-01-28 16:47:47 -06:00
Steve Karg 20f402f5b6 Fix lighting output commands for warn-off and warn-relinquish (#1212)
* Fixed lighting output object lighting-commands for warn-off and warn-relinquish when blink-warn notification shall not occur.

* Fixed timer object task to initiate a write-request at expiration.

* Added channel and timer object write-property observers in blinkt app to monitor internal writes.

* Added vacancy timer command line argument in blinkt app for testing initial timer object vacancy time for lights channel.
2026-01-28 06:39:02 -06:00
Steve Karg b6d895ccf0 Update BACnet protocol revision and enhance lighting output handling (#1211)
* Changed apps to build at protocol-revision 28 to be able to use the lighting output special values by default.

* Fixed blinkt app server name and removed the device.c module which was no longer needed.

* Added debug prints for lighting-output object for present-value and lighting-command property values which may be out-of-range.
2026-01-27 10:45:28 -06:00
Steve Karg 2b59aa1a99 Add RGB pixel and brightness APIs, update Blinkt example (#1210)
* Added API to get the RGB pixel and brightness values from the blinkt interface.

* Fixed Channel object for Color object present-value which does not use coercion.

* Added API to the color-RGB library to convert from ASCII CSS color name to X,Y and brightness.

* Converted the Blinkt example app to use the basic-server.  Added a default color name command line option --color that accepts CSS color names. Set the color and brightness at startup.

* Added vacancy timer for lights using timer object defaulted to 30m and started at startup.
2026-01-27 07:34:32 -06:00
Steve Karg 4924a57ccc Add enumeration text lookup for BACnet types (#1209)
* Added enumeration text lookup for BACnetAuthenticationStatus, BACnetAuthorizationMode, BACnetAccessCredentialDisable, BACnetAccessCredentialDisableReason, BACnetAccessUserType, BACnetAccessZoneOccupancyState, BACnetWriteStatus, BACnetIPMode, BACnetDoorValue, BACnetMaintenance, BACnetEscalatorFault, BACnetEscalatorMode, BACnetEscalatorOperationDirection, BACnetBackupState, BACnetSecurityLevel, BACnetLiftCarDirection, BACnetLiftCarDoorCommand, BACnetLiftCarDriveStatus, BACnetLiftCarMode, BACnetLiftFault, BACnetLiftGroupMode, BACnetAuditLevel, BACnetAuditOperation, BACnetSCHubConnectorState, BACnetSCConnectionState, BACnetNodeRelationship, BACnetAction, BACnetFileAccessMethod, BACnetLockStatus, BACnetDoorAlarmState, BACnetDoorStatus, BACnetDoorSecuredStatus, and BACnetAccessEvent.

* Created BINARY_PV_MAX with the same semantic meaning as one more than the last valid enumeration, and deprecated MAX_BINARY_PV usage in the examples.

* Reduced code size by using bactext_property_states_strtoul() instead of individual API for each enumations.
2026-01-24 16:11:25 -06:00
Steve Karg 81c42566a7 Enhance C89 compatibility by replacing strtof and strtold with strtod in conversion functions (#1207) 2026-01-21 12:12:06 -06:00
Steve Karg 1dead40afa Increase unit test coverage for device object (#1208) 2026-01-21 12:02:34 -06:00
Steve Karg 3a0878a254 Add API for writable object property lists (#1206)
Added a new API for writable property lists across all the basic example object types, preparing for the introduction of a Writable_Property_List property in every object in a future BACnet standard revision.

The lists can be used by backup and restore feature to automatically choose the object property values in the backup that can be restored via internal WriteProperty directly from BACnet CreateObject services with  List of Initial Values. 

Updated existing device object examples to include these writable property lists.
2026-01-21 10:02:21 -06:00
Steve Karg c408cc555b Update Last_On_Value logic for Present_Value property (#1205)
* Fixed lighting output object lighting-command last-on-value to only
  be updated with the last value of the Present_Value property that
  was greater than or equal to 1.0%, keeping in mind that the Present_Value
  shall indicate the target level of the operation and not the current
  value.
2026-01-20 15:44:04 -06:00
Steve Karg 89cf25c2b2 Added post-write notifications for channel, timer, and loop objects. (#1204) 2026-01-20 13:13:45 -06:00
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