Skip to content

Fix Buffer overflow in cupsSideChannelSNMPGet() - #1719 - #1720

Open
PavlNekrasov wants to merge 1 commit into
OpenPrinting:masterfrom
PavlNekrasov:fix-tainted-int-overflow-sidechannel-snmp
Open

PavlNekrasov wants to merge 1 commit into
OpenPrinting:masterfrom
PavlNekrasov:fix-tainted-int-overflow-sidechannel-snmp

Conversation

@PavlNekrasov

Copy link
Copy Markdown

fixed #1719

Solution: Located the OID terminator with memchr() within the received length in both functions and rejected a response without one as CUPS_SC_STATUS_BAD_MESSAGE.

Signed-off-by: p.nekrasov@fobos-nt.ru
Signed-off-by: Timofei Fedotov sovtouch@altlinux.org

@michaelrsweet michaelrsweet self-assigned this Sep 24, 2026
@michaelrsweet michaelrsweet added the investigating Investigating the issue label Sep 24, 2026
@michaelrsweet

Copy link
Copy Markdown
Member

In the future, please combine bug report and PR into a single PR with the full explanation of the bug. Doing both just gives both of us extra work.

@michaelrsweet

Copy link
Copy Markdown
Member

Also, please start signing your commits...

Problem:
cupsSideChannelSNMPGet() takes the OID length from strlen() without checking that the nul terminator is inside the bytes the backend actually sent, so strlen() runs into the uninitialised tail of the buffer, real_datalen goes negative and memcpy() gets (size_t)real_datalen as its size. cupsSideChannelSNMPWalk() has the same flaw, and its guard against it measures sizeof() a char pointer instead of the buffer, so it only fires below 8 bytes.
Solution: Located the OID terminator with memchr() within the received length in both functions and rejected a response without one as CUPS_SC_STATUS_BAD_MESSAGE.
Signed-off-by: p.nekrasov@fobos-nt.ru
Signed-off-by: Timofei Fedotov sovtouch@altlinux.org
@PavlNekrasov
PavlNekrasov force-pushed the fix-tainted-int-overflow-sidechannel-snmp branch from c784ad3 to a69f054 Compare September 25, 2026 12:44
@PavlNekrasov

Copy link
Copy Markdown
Author

The commit has now been signed and forced-pushed.

This branch has not been deployed

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

Labels

investigating Investigating the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buffer overflow in cupsSideChannelSNMPGet()

2 participants