Skip to content

cupsfilters: ieee1284: fix stack-buffer-overflow in cfIEEE1284NormalizeMakeModel#138

Closed
nomkar24 wants to merge 1 commit intoOpenPrinting:masterfrom
nomkar24:fixes_issue_#136
Closed

cupsfilters: ieee1284: fix stack-buffer-overflow in cfIEEE1284NormalizeMakeModel#138
nomkar24 wants to merge 1 commit intoOpenPrinting:masterfrom
nomkar24:fixes_issue_#136

Conversation

@nomkar24
Copy link
Copy Markdown
Contributor

Ensure that the model name pointer (modelptr) is always clamped to the actual string length in the buffer, preventing memory corruption when normalizing printer strings with long manufacturer names.

Key changes:

  • Clamp modelptr to buffer + strlen(buffer) after snprintf calls

  • Add a safety guard to ensure modelptr never exceeds valid string bounds

  • Add bounds checks to the while loop that removes repeated manufacturer names

  • Prevent strncasecmp from performing out-of-bounds reads on the stack

    fixes stack-buffer-overflow in cfIEEE1284NormalizeMakeModel() #136

@ValdikSS
Copy link
Copy Markdown
Member

Please make it properly, without formatting change.

…rmalizeMakeModel

Ensure that the model name pointer (modelptr) is always clamped to the
actual string length in the buffer, preventing memory corruption when
normalizing printer strings with long manufacturer names.

Key changes:
- Clamp modelptr to buffer + strlen(buffer) after snprintf calls
- Add a safety guard to ensure modelptr never exceeds valid string bounds
- Add bounds checks to the while loop that removes repeated manufacturer names
- Prevent strncasecmp from performing out-of-bounds reads on the stack
  fixes OpenPrinting#136
Signed-off-by: Omkar Nanajkar <nomkar2131@gmail.com>
@nomkar24
Copy link
Copy Markdown
Contributor Author

ill make a new PR 'Auto format on save' caused this issue.

@nomkar24 nomkar24 closed this Mar 24, 2026
@ValdikSS
Copy link
Copy Markdown
Member

You don't have to close the existing PR, just force-push to your branch and it will update.

@nomkar24
Copy link
Copy Markdown
Contributor Author

sorry for that. I made a new PR can u plz review it @ValdikSS

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.

stack-buffer-overflow in cfIEEE1284NormalizeMakeModel()

2 participants