Skip to content

fix: use snprintf in Caesar.c - #2

Open
anupamme wants to merge 2 commits into
Lellansin:masterfrom
anupamme:fix-repo-cipher-examples-caesar-buffer-overflow
Open

fix: use snprintf in Caesar.c#2
anupamme wants to merge 2 commits into
Lellansin:masterfrom
anupamme:fix-repo-cipher-examples-caesar-buffer-overflow

Conversation

@anupamme

Copy link
Copy Markdown

Summary

Fix critical severity security issue in c/Caesar.c.

Vulnerability

Field Value
ID V-001
Severity CRITICAL
Scanner multi_agent_ai
Rule V-001
File c/Caesar.c:31
Assessment Likely exploitable

Description: The caesar() function uses sprintf() to concatenate characters into the 'result' buffer without bounds checking. The result buffer is allocated as 1024 bytes in main() at line 49. If input exceeds 1024 characters, the sprintf calls will write beyond the buffer boundary, corrupting adjacent stack memory.

Evidence

Exploitation scenario: An attacker who can control the input string to the Caesar cipher provides a string exceeding 1024 characters.

Scanner confirmation: multi_agent_ai rule V-001 flagged this pattern.

Production code: This file is in the production codebase, not test-only code.

Changes

  • c/Caesar.c

Behavior Preservation

The change is scoped to 1 file on the vulnerable path; it only tightens handling of untrusted input and leaves valid inputs unaffected.


Automated security fix by OrbisAI Security

Lellansin and others added 2 commits August 29, 2026 11:04
Automated security fix generated by OrbisAI Security
@Lellansin
Lellansin force-pushed the master branch 2 times, most recently from edc20a9 to bbc1bea Compare August 30, 2026 02:07
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.

2 participants