u-root / webboot

Tools to let a u-root instance boot signed live distro images over the web
BSD 3-Clause "New" or "Revised" License
110 stars 25 forks source link

Panic while scanning for wifi connections #248

Open rjoleary opened 3 years ago

rjoleary commented 3 years ago

Describe the bug In the "Scanning for wifi networks..." screen, webboot crashed and returned to the shell. I attached a screenshot (sorry I couldn't come up with a good way to get the text off the screen at the time):

screen1

screen2

To Reproduce I do not get this panic every time -- in fact, I've only seen it once. The wifi connection usually works.

Expected behavior It should have scanned for wifi networks. Additionally, webboot shouldn't panic like this and instead display an error more gracefully.

Additional context The "index out of range [33] with length 33" might indicate an out-of-bounds error. The "end of history Unbound: Ctrl-[" stuff at the end is elvish junk that can be ignored.

orangecms commented 3 years ago

https://github.com/u-root/webboot/blob/main/pkg/wifi/iwl.go#L103 I'd propose to do that in multiple steps and sanitize / check for unsupported values.

orangecms commented 3 years ago

Note that the list index comes from another variable than the one being accessed. We cannot guarantee that they are in sync (or the same order). The API we are constructing currently is splitting by RE on fields globally and then trying to unify them again, IIUC. Compare that to a table with potentially empty cells. That means that any entry with some field not matching its RE breaks the alignment. Instead, I'd suggest treating each access point entry one by one and see if it has all the fields.