Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buffer overflow in progs global string functions #91

Merged
merged 1 commit into from
Dec 25, 2023

Conversation

alexey-lysiuk
Copy link
Contributor

Using v1.06 progs.dat, the following code causes buffer overflow as string value it references is long enough to fill entire line variable

PR_PrintStatement(&pr_statements[5821]);

@sezero
Copy link
Owner

sezero commented Dec 25, 2023

Thanks. Can you make lastchari static const, instead? E.g. like:

 	static char	line[512];
+	static const int lastchari = Q_COUNTOF(line) - 2;
 	const char	*s;

Using v1.06 `progs.dat`, the following code causes buffer overflow as string value it references is long enough to fill entire `line` variable

```c
PR_PrintStatement(&pr_statements[5821]);
```
@sezero sezero merged commit f20e894 into sezero:master Dec 25, 2023
8 checks passed
@alexey-lysiuk alexey-lysiuk deleted the fix_progs_global branch December 25, 2023 14:24
@sezero
Copy link
Owner

sezero commented Dec 25, 2023

Thanks, this is in. (Applied a tiny reorganization as a follow-up as b3b4203)

@alexey-lysiuk
Copy link
Contributor Author

Thanks, this is in. (Applied a tiny reorganization as a follow-up as b3b4203)

Sorry, I missed the fact that new variable was moved to a different line in your code snippet.

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