Skip to content

fix: five unbounded strcpy() calls in the parser and... in...#148976

Closed
orbisai0security wants to merge 1 commit intopython:mainfrom
orbisai0security:fix-v-001-strcpy-buffer-overflow-freeze-module
Closed

fix: five unbounded strcpy() calls in the parser and... in...#148976
orbisai0security wants to merge 1 commit intopython:mainfrom
orbisai0security:fix-v-001-strcpy-buffer-overflow-freeze-module

Conversation

@orbisai0security
Copy link
Copy Markdown

Summary

Fix critical severity security issue in Programs/_freeze_module.c.

Vulnerability

Field Value
ID V-001
Severity CRITICAL
Scanner multi_agent_ai
Rule V-001
File Programs/_freeze_module.c:156

Description: Five unbounded strcpy() calls in the parser and freeze module copy attacker-influenced strings into fixed-size or dynamically allocated buffers without validating that the source length fits within the destination. In Programs/_freeze_module.c:156, strcpy(varname, prefix) copies a module-name-derived prefix into a fixed-size buffer. In Parser/tokenizer/file_tokenizer.c:44 and :225, strcpy copies tokenizer input (line and buf) without length validation. At :488, strcpy copies tok->encoding into a fixed-size encoding buffer. In Parser/string_parser.c:162, strcpy copies into a buffer whose surrounding management may be insufficient.

Changes

  • Programs/_freeze_module.c

Verification

  • Build passes
  • Scanner re-scan confirms fix
  • LLM code review passed

Automated security fix by OrbisAI Security

Automated security fix generated by Orbis Security AI
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Apr 25, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Apr 25, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Apr 25, 2026

Please read the devguide first before opening PRs especially https://devguide.python.org/getting-started/generative-ai/. filename has enough space as it's allocated with strlen(name) + 10.

@picnixz picnixz closed this Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants