Commit 44ef632c by xiongziliang

修复可能内存越界的bug

parent 71c9b11e
...@@ -260,7 +260,7 @@ string System::execute(const string &cmd) { ...@@ -260,7 +260,7 @@ string System::execute(const string &cmd) {
} }
string ret; string ret;
char buff[1024] = {0}; char buff[1024] = {0};
while(fgets(buff, sizeof(buff), fPipe)){ while(fgets(buff, sizeof(buff) - 1, fPipe)){
ret.append(buff); ret.append(buff);
} }
pclose(fPipe); pclose(fPipe);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论