提交 8d6a1b2c 编写于 作者: M Matthias Bolte

phyp: Break potential infinite loops

上级 3cc8a660
...@@ -1040,9 +1040,13 @@ phypListDomainsGeneric(virConnectPtr conn, int *ids, int nids, ...@@ -1040,9 +1040,13 @@ phypListDomainsGeneric(virConnectPtr conn, int *ids, int nids,
goto err; goto err;
else { else {
while (got < nids) { while (got < nids) {
if (ret[i] == '\n') { if (ret[i] == '\0')
if (virStrToLong_i(id_c, &char_ptr, 10, &ids[got]) == -1) break;
return 0; else if (ret[i] == '\n') {
if (virStrToLong_i(id_c, &char_ptr, 10, &ids[got]) == -1) {
VIR_ERROR("Cannot parse number from '%s'", id_c);
goto err;
}
memset(id_c, 0, 10); memset(id_c, 0, 10);
j = 0; j = 0;
got++; got++;
...@@ -1112,7 +1116,8 @@ phypListDefinedDomains(virConnectPtr conn, char **const names, int nnames) ...@@ -1112,7 +1116,8 @@ phypListDefinedDomains(virConnectPtr conn, char **const names, int nnames)
} }
char_ptr2++; char_ptr2++;
domains = char_ptr2; domains = char_ptr2;
} } else
break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册