mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 05:45:46 +00:00
esx: Fix nodeGetInfo so cpu model fits inside nodeinfo->model
Commit 6c0d0210cb
changed the behavior of
virStr*cpy* functions, so now the nodeGetInfo call fails. Version 4.1.0
(default for Fedora 28) works:
Model: Intel Core i7-4500U CPU @ 1.80G
Current master tries to write "Intel Core i7-4500U CPU @ 1.80GHz", but
the string is bigger than nodeinfo->model (which is a char[32]). So this
patch "cuts" the string, and presents the same output from 4.1.0.
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
This commit is contained in:
parent
86db0db979
commit
242b7c2d38
@ -1317,6 +1317,8 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
|
|||||||
++ptr;
|
++ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure the string fits in mode */
|
||||||
|
dynamicProperty->val->string[sizeof(nodeinfo->model) - 1] = '\0';
|
||||||
if (virStrcpyStatic(nodeinfo->model, dynamicProperty->val->string) < 0) {
|
if (virStrcpyStatic(nodeinfo->model, dynamicProperty->val->string) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("CPU Model %s too long for destination"),
|
_("CPU Model %s too long for destination"),
|
||||||
|
Loading…
Reference in New Issue
Block a user