Skip to content

ArduinoOTA: don't crash on unrecognized packets - #4086

Merged
devyte merged 2 commits into
esp8266:masterfrom
yoursunny:bug3912
Jan 4, 2018
Merged

ArduinoOTA: don't crash on unrecognized packets#4086
devyte merged 2 commits into
esp8266:masterfrom
yoursunny:bug3912

Conversation

@yoursunny

Copy link
Copy Markdown
Contributor

No description provided.

@devyte

devyte commented Jan 4, 2018

Copy link
Copy Markdown
Collaborator

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

@Juppit Juppit left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

devyte commented Jan 4, 2018

Copy link
Copy Markdown
Collaborator

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