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

Buffer overrun on strcpy in parse_operand #84

Closed
nihirash opened this issue Jun 30, 2024 · 3 comments
Closed

Buffer overrun on strcpy in parse_operand #84

nihirash opened this issue Jun 30, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@nihirash
Copy link

Issue #83 wasn't platform specific but was common for all platforms - buffer overrun on strcpy.

In my case buffer overrun happens here:

strcpy(operand->immediate_name, string);

As operand in context was calculating between two labels term_free_cmd_end - term_free_cmd(33 bytes, when maximum size was 32) - so this situation is possible for another cases too.

Simplest way move away issue - making this constant larger:

#define MAXNAMELENGTH 32 // Maximum name length of labels

Best way - check string size before copying it to resulting buffer(and increase buffer size too).

@envenomator envenomator self-assigned this Jul 1, 2024
@envenomator envenomator added the bug Something isn't working label Jul 1, 2024
@envenomator
Copy link
Owner

This is something I can work with. Too many people are dumping their git repo URL to me, stating 'this doesn't work'. Combine this with a platform I'm not supporting (which I get lots of questions about, even when I'm not releasing binaries for these), not a good combination.

I can reproduce this issue. It happens during the operand stage, when the operand itself has a maximum of LINEMAX characters at read, while the buffer is defined as MAXNAMELENGTH. I'll fix this in the next release.

@nihirash
Copy link
Author

nihirash commented Jul 1, 2024

Sorry, I'll try be a bit more correct next time.

@envenomator
Copy link
Owner

Fixed as part of release v1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants