Skip to content

Comments

length values >= 256 need 3 bytes to encode their length#1

Merged
N1IOX merged 1 commit intomasterfrom
fix-encoding-length
Jan 12, 2026
Merged

length values >= 256 need 3 bytes to encode their length#1
N1IOX merged 1 commit intomasterfrom
fix-encoding-length

Conversation

@N1IOX
Copy link
Owner

@N1IOX N1IOX commented Jan 12, 2026

a length of exactly 256 should be encoded as:
0x82 0x01 0x00

without this change, I was seeing the encoded length of a get response (that happened to be exactly 256 bytes long) encoded as: 0x81 0x00

that was causing snmpbulkwalk to fail, since it was reading the encoded length as 0.

a length of exactly 256 should be encoded as:
0x82 0x01 0x00

without this change, I was seeing the encoded length of a get response (that happened to be exactly 256 bytes long) encoded as:
0x81 0x00

that was causing snmpbulkwalk to fail, since it was reading the encoded length as 0.
@N1IOX N1IOX merged commit 291e3d6 into master Jan 12, 2026
@N1IOX N1IOX deleted the fix-encoding-length branch January 15, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant