Skip to content

ArduinoOTA: don't crash on unrecognized packets #4086

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

Merged
merged 2 commits into from
Jan 4, 2018

Conversation

yoursunny
Copy link
Contributor

No description provided.

@devyte
Copy link
Collaborator

devyte commented Jan 4, 2018

Nice job figuring this out!

@devyte devyte merged commit d9ef6b5 into esp8266:master Jan 4, 2018
@yoursunny yoursunny deleted the bug3912 branch January 4, 2018 03:58
Copy link
Contributor

@Juppit Juppit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the for loop index is now incremented double, definitely on line 155, which should now be
data[index]

@lrmoreno007
Copy link
Contributor

@Juppit Yes, that solve the problem.

And an observation, in the function readStringUntil, now value is an integer but later it is compared with two char ('\ 0' and end).

From my little knowledge, I think this is better to leave it as it was.

@yoursunny
Copy link
Contributor Author

With the for loop index is now incremented double

Oops, I didn’t notice that. I’m not used to while loops.
I wish there’s a way to have automated tests...

in the function readStringUntil, now value is an integer but later it is compared with two char ('\ 0' and end).

I believe these are fine. char is implicitly convertable to int without losing precision, and they are compared as int.

@devyte
Copy link
Collaborator

devyte commented Jan 4, 2018

I missed that as well. If someone makes a PR, I'll look at it and merge it asap.

devyte pushed a commit that referenced this pull request Jan 4, 2018
* Update ArduinoOTA.cpp

* Update ArduinoOTA.cpp
incosystem pushed a commit to incosys/Arduino that referenced this pull request Jan 8, 2018
* ArduinoOTA: handle end of packet in readStringUntil

fixes esp8266#3912

* ArduinoOTA: fix buffer overflow in parseInt

fixes esp8266#3912
incosystem pushed a commit to incosys/Arduino that referenced this pull request Jan 8, 2018
* Update ArduinoOTA.cpp

* Update ArduinoOTA.cpp
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.

4 participants