In commit d2632d60 we agreed taht we want the parsed uid to properly
overflow but only to -1, however the value was read into long and then
wrapped into uid_t. That meaned it failed on 32-bit systems.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
Pushed as build-breaker
src/conf/storage_conf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index e1be064..e9aaa8a 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -734,7 +734,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
int defaultmode)
{
char *mode;
- long val;
+ long long val;
int ret = -1;
xmlNodePtr relnode;
xmlNodePtr node;
@@ -771,7 +771,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
if (virXPathNode("./owner", ctxt) == NULL) {
perms->uid = (uid_t) -1;
} else {
- if (virXPathLong("number(./owner)", ctxt, &val) < 0 ||
+ if (virXPathLongLong("number(./owner)", ctxt, &val) < 0 ||
((uid_t)val != val &&
val != -1)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -785,7 +785,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
if (virXPathNode("./group", ctxt) == NULL) {
perms->gid = (gid_t) -1;
} else {
- if (virXPathLong("number(./group)", ctxt, &val) < 0 ||
+ if (virXPathLongLong("number(./group)", ctxt, &val) < 0 ||
((gid_t) val != val &&
val != -1)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
--
2.2.0