提交 3be8c1f0 编写于 作者: P Peter Krempa

leaseshelper: Skip entries missing expiry time on INIT action

Coverity pointed out that in other places we always check the return
value from virJSONValueObjectGetNumberLong() but not in the new addition
in leaseshelper. To solve the issue and also be more robust in case
somebody would corrupt the file, skip outputting of the lease entry in
case the expiry time is missing.
上级 87b9437f
...@@ -397,7 +397,10 @@ main(int argc, char **argv) ...@@ -397,7 +397,10 @@ main(int argc, char **argv)
goto cleanup; goto cleanup;
} }
if (!strchr(ip_tmp, ':')) { if (!strchr(ip_tmp, ':')) {
virJSONValueObjectGetNumberLong(lease_tmp, "expiry-time", &expirytime); if (virJSONValueObjectGetNumberLong(lease_tmp, "expiry-time",
&expirytime) < 0)
continue;
printf("%lld %s %s %s %s\n", printf("%lld %s %s %s %s\n",
expirytime, expirytime,
virJSONValueObjectGetString(lease_tmp, "mac-address"), virJSONValueObjectGetString(lease_tmp, "mac-address"),
...@@ -418,7 +421,10 @@ main(int argc, char **argv) ...@@ -418,7 +421,10 @@ main(int argc, char **argv)
goto cleanup; goto cleanup;
} }
if (strchr(ip_tmp, ':')) { if (strchr(ip_tmp, ':')) {
virJSONValueObjectGetNumberLong(lease_tmp, "expiry-time", &expirytime); if (virJSONValueObjectGetNumberLong(lease_tmp, "expiry-time",
&expirytime) < 0)
continue;
printf("%lld %s %s %s %s\n", printf("%lld %s %s %s %s\n",
expirytime, expirytime,
virJSONValueObjectGetString(lease_tmp, "iaid"), virJSONValueObjectGetString(lease_tmp, "iaid"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册