Skip to content

Tighten decoding of packages#189

Merged
adamdickmeiss merged 28 commits into
masterfrom
cs-complete-may-return-error
Jun 9, 2026
Merged

Tighten decoding of packages#189
adamdickmeiss merged 28 commits into
masterfrom
cs-complete-may-return-error

Conversation

@adamdickmeiss

Copy link
Copy Markdown
Contributor

No description provided.

@adamdickmeiss adamdickmeiss changed the title Cs complete may return error Tighten decoding of packages Jun 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens incoming PDU decoding and error classification across COMSTACK transports and BER/HTTP completeness detection, with stricter limits on maximum received PDU sizes and clearer protocol-error signaling.

Changes:

  • Enforces a 16MB maximum incoming PDU size (TCP/IP, UNIX sockets, and server defaults) and treats malformed PDUs as protocol errors.
  • Updates HTTP/BER “complete PDU” detection to return -1 on protocol errors, and plumbs a new CSPROTERR error code through the stack.
  • Improves ODR constructed-type stack depth tracking to avoid re-walking the stack for depth checks.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/zoom-c.c Adjusts cs_get error handling/logging during ZOOM read processing.
src/yaz/comstack.h Documents cs_complete_auto* return semantics and adds CSPROTERR.
src/unix.c Adds max receive cap and propagates protocol-error detection from complete(); updates cs_more semantics.
src/tcpip.c Reduces default max_recv_bytes, tightens buffer growth, and maps complete()<0 to protocol error.
src/statserv.c Lowers default maximum allowed PDU size to 16MB.
src/seshigh.c Uses protocol error reasons for Close PDUs and updates error-path message ownership semantics.
src/odr.c Resets new stack_depth field on odr_reset.
src/odr-priv.h Introduces stack_depth and updates ODR_STACK_POP to maintain it.
src/odr_cons.c Replaces stack-depth counting loop with stack_depth tracking.
src/comstack.c Adds new protocol error message and hardens HTTP parsing/completeness logic.
src/ber_tag.c Updates ber_dectag return-value documentation.
src/ber_len.c Tightens BER length decoding to reject lengths too large for int.
src/ber_any.c Treats malformed BER as protocol error (-1) rather than “complete”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/seshigh.c
Comment thread src/comstack.c Outdated
Comment thread src/comstack.c Outdated
Comment thread src/unix.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread src/unix.c Outdated
Comment thread src/tcpip.c Outdated
Comment thread src/comstack.c

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Comment thread src/yaz/atoi.h Outdated
Comment thread src/atoin.c
Comment thread src/ber_any.c

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Comment thread src/comstack.c
Comment thread src/unix.c Outdated
Comment thread src/tcpip.c Outdated
Comment thread src/yaz/odr.h Outdated
Comment thread src/comstack.c

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Comment thread src/unix.c
Comment thread src/tcpip.c Outdated
@adamdickmeiss adamdickmeiss merged commit c5e2974 into master Jun 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants