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 swapNames in session-three files #5

Merged
merged 3 commits into from
Dec 9, 2021

Conversation

reubensammut
Copy link
Contributor

The function swapNames in pointers-struct.c and enums.c have an incorrect function signature. If we're swapping what username and password point to as it seems to be the case when calling the swapNames function from main, both parameters should be of type char ** and not char *.

This change also fixes the ELF generated which seems to be swapping just the first character of an address instead of swapping the strings. In reality it only works as both argv[2] and argv[3] are very close and we're just changing the last byte of the address. There could be cases where the addresses of argv[2] and argv[3] have the last two bytes which are different

Also removed unnecessary malloc which was also not being freed.

Should this pull request be accepted, the relevant binaries would also need to be updated

- Updated signature to match call on line 69 
- Removed unnecessary `malloc` as we're only changing pointers
- Removed call to `free` as `malloc` was removed
Added calls to `free` for `info.password` allocated by `gen_password`
- Updated signature to match call on line 71
- Removed unnecessary `malloc` as we're only changing pointers
@wrongbaud
Copy link
Owner

Just merged this - thanks for pointing this out!

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.

None yet

2 participants