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

Hello, smbios/structrue.go的GetString函数可能数组越界panic #24

Open
linzhanglong opened this issue Nov 2, 2022 · 0 comments

Comments

@linzhanglong
Copy link

linzhanglong commented Nov 2, 2022

func (s *Structure) GetString(offset int) string {
if offset > s.FormattedCount()-1 {
return "Unknown"
}

index := s.Formatted[offset]

if index == 0 {
	return "Unknown"
}

return s.Strings[index-1]  // 这里是否需要判断下是否越界,否则异常下会直接panic?

}

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

1 participant