修复可能内存越界的bug

This commit is contained in:
xiongziliang 2019-06-20 18:36:55 +08:00
parent 71c9b11eca
commit 44ef632c76

View File

@ -260,7 +260,7 @@ string System::execute(const string &cmd) {
}
string ret;
char buff[1024] = {0};
while(fgets(buff, sizeof(buff), fPipe)){
while(fgets(buff, sizeof(buff) - 1, fPipe)){
ret.append(buff);
}
pclose(fPipe);