捉个虫:下标运算符参数越界未处理

main
lensfrex 3 years ago
parent 589f674f02
commit 39f8b9a333
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 2
      work20220401/neoString/CString.cpp

@ -149,5 +149,5 @@ std::istream &operator>>(std::istream &inputStream, const CString &source) {
}
char CString::operator[](const int i) const {
return data[i];
return (i < MAX_LENGTH) ? data[i] : '\0';
}
Loading…
Cancel
Save