Skip to content

Reading the Device's Description aborts: DEVICE_DESCRIPTION is 286 chars, over the stack's 256-character limit #7

Closed

Description

@sws-chipkin

Reading the Device object's Description returns an Abort (reason: other), not the string. Every other character-string property on the device reads fine.

DEVICE_DESCRIPTION in main.cpp is 286 characters. STACK_OPTION_MAX_CHARACTER_STRING_SIZE is 256 on the full target (submodules/cas-bacnet-stack/source/CASBACnetStackOptions.h), so ReturnCharacterString() truncates it — and the read then fails outright rather than returning the truncated string.

The comment on that truncation guard says the opposite:

// Truncate SILENTLY to fit the stack's buffer. maxElementCount is
// MAX_CHARACTER_STRING_SIZE (256 in this build), and our longest string
// (DEVICE_DESCRIPTION) fits with room to spare - so this never trips
// here.

It does trip here, on this build, on this string.

Steps to reproduce

Run the example and read Device 389005 Description (property 28):

810a001101040005800c0c0205ef8d191c

Actual

810a00090100718000

Abort-PDU, server = 1, abort reason 0 (other).

Expected

A Complex-ACK with the description, the way Object_Name answers:

-> 810a001101040005820c0c0205ef8d194d
<- 810a001c010030820c0c0205ef8d194d3e7508005261696e626f773f     (= "Rainbow")

Suggested fix

Shorten DEVICE_DESCRIPTION to 256 characters or fewer, and make the truncation loud rather than silent — the comment already argues for that for the EMBEDDED target, and this is the case it was written to catch.

Worth a look separately: truncating to exactly maxElementCount still produced an Abort rather than a short string, so the guard as written would not have saved the read even if it had been reached deliberately. That may be a stack-side limit worth its own issue.

Also found in the same session

  • docs/PICS.md and README.md say Protocol_Revision 24; the running device reports 26.
  • The Device's Property_List advertises localDate and localTime, but reading either returns Error (object, read-access-denied). GetPropertyDate / GetPropertyTime in main.cpp serve only File 1's Modification_Date. The example claims DM-TS-B, and reading those two back is the usual way a client confirms a time sync took.

Environment

Found by sending every service in the PICS from the Chipkin BACnet Explorer's command pages against a live instance of this example (device 389005 at 192.168.3.73:47808). Everything else in DS-RP-B, DS-RPM-B, DS-WP-B, DS-WPM-B, DM-DDB-B, DM-DOB-B, AE-N-I-B, AE-ACK-B, AE-INFO-B, AE-CRL-B, T-ATR-B, DM-DCC-B, DM-TS-B, DM-UTC-B and DM-BR-B answered correctly.

Activity

  1. sws-chipkin commented on Sep 18, 2026

    @sws-chipkin
    CollaboratorAuthor

    Fixed in #8 (merged): DEVICE_DESCRIPTION shortened under the 256-char limit, Local_Date/Local_Time now served with real wall-clock time, Protocol_Revision docs corrected to 26. Verified live against a rebuilt binary, including confirming ReadPropertyMultiple(ALL) on the Device object now succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions