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 crasahes in doParamSave() & WiFiManagerParameter::setValue #660

Merged
merged 2 commits into from
Jul 16, 2018

Conversation

liebman
Copy link
Contributor

@liebman liebman commented Jul 15, 2018

Had crashes in doParamSave().

Changed to use server.hasParam() instead of checking server.arg() for NULL, it returns a String not a pointer.

Don't use .c_str() when its being assigned to a String. I think using .c_str() on String that are transient is probably not safe.

…a String anyway.

Don't use .c_str() when its being assigned to a String anyway
@liebman
Copy link
Contributor Author

liebman commented Jul 15, 2018

Wait on this - I think I'm still getting crashes :-(

allocation and not passed length. Changed to use passed length or
length of default value if > passed length.
@liebman liebman changed the title Fix crasahes in doParamSave() Fix crasahes in doParamSave() & @liebman WiFiManagerParameter::setValue Jul 15, 2018
@liebman liebman changed the title Fix crasahes in doParamSave() & @liebman WiFiManagerParameter::setValue Fix crasahes in doParamSave() & WiFiManagerParameter::setValue Jul 15, 2018
@liebman
Copy link
Contributor Author

liebman commented Jul 15, 2018

Ok so WiFiManagerParameter::setValue() used the length of the default parameter for buffer allocation. In my case its for a webservice URL and I passed length as 1024 but default value as "" so it only allocated 1 byte. Then when doParamSave() was called it copied a s string into that buffer trashing memory.

@tablatronix
Copy link
Collaborator

Sorry about that, I was still testing this to catch some edge cases. I Should have used a branch.

@tablatronix
Copy link
Collaborator

I clicked merge last night I guess It didnt go through oops

@tablatronix tablatronix merged commit 36ad6f8 into tzapu:development Jul 16, 2018
@liebman liebman deleted the do_param_save branch July 16, 2018 14:57
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