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

Hitting unknown entry leads to crashing #11

Open
NtWriteCode opened this issue Dec 4, 2024 · 1 comment
Open

Hitting unknown entry leads to crashing #11

NtWriteCode opened this issue Dec 4, 2024 · 1 comment

Comments

@NtWriteCode
Copy link

https://github.com/brunexgeek/smbios-parser/blob/master/smbios.c#L651
This should be:
SMBERR_UNKNOWN_TYPE

Also may worth noting that in case the user gets SMBERR_INVALID_DATA or SMBERR_UNKNOWN_TYPE during the call of smbios_next(), that may not be a good reason to stop iterating (unlike the sample code suggests). As far as I can see, the code can safely continue iterating.

Let me know if I misunderstood anything :)
Thanks in advance!

@brunexgeek
Copy link
Owner

brunexgeek commented Dec 8, 2024

I recently refactored the code but didn't provide enough documentation at the time. I updated the code and the readme now.

  • Regarding the crash, could you provide the SMBIOS data causing it? If you can't or prefer not to, I can also work with a stack trace pinpointing the error (e.g. from gdb). I just merged a change that includes some validations during data parsing, which may solve your issue.

  • The error SMBERR_UNKNOWN_TYPE was no longer used and I removed it from the header file. The code will return SMBERR_OK even for unknown entries, as these can still be read with the rawdata field.

  • The error SMBERR_INVALID_DATA is returned when it's impossible or difficult to recover from invalid data (e.g. missing important information or a terminator). If you have a specific case, I can look into it and see if there's a simple solution to recover from it.

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

No branches or pull requests

2 participants