python-ipmi icon indicating copy to clipboard operation
python-ipmi copied to clipboard

rx_filter needs to check size of data[] before parsing

Open rmccourt opened this issue 1 year ago • 1 comments

In interfaces/ipmb.py, the rx_filter function assumes that all the fields are present in the data array. If that's not the case, then the code crashes. I was able to fix it by adding a check at line 241 if len(data) < 7: return False

Not sure if it's unique to my setup, but the Aardvark I am using consistently seems to return just the address byte on the first iteration of the polling loop when looking for an IPMB response. Then the rx_filter code tries to index off the end of data[] and bombs out.

The real fix maybe needs more sophistication (or at least not just a magic number) - not totally sure. I guess I'm hoping that pointing this out will let somebody more knowledgeable drop in a real fix.

Thanks

rmccourt avatar Sep 07 '24 22:09 rmccourt

Hi, you're right .. hanling an invalid length of data is not yet really implemented. Could you please create a PR with your thoughts and let discuss this there.

hthiery avatar Sep 09 '24 06:09 hthiery