Skip to content

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

@linzhanglong

Description

@linzhanglong

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?

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions