dmidecode icon indicating copy to clipboard operation
dmidecode copied to clipboard

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

Open linzhanglong opened this issue 2 years ago • 0 comments

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?

}

linzhanglong avatar Nov 02 '22 03:11 linzhanglong