#define VIR_FROM_THIS VIR_FROM_OPENVZ
static char *openvzLocateConfDir(void);
-static int openvzGetVPSUUID(int vpsid, char *uuidstr);
+static int openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len);
static int openvzLocateConfFile(int vpsid, char *conffile, int maxlen, const char *ext);
static int openvzAssignUUIDs(void);
if (virAsprintf(&dom->def->name, "%i", veid) < 0)
goto no_memory;
- openvzGetVPSUUID(veid, uuidstr);
+ openvzGetVPSUUID(veid, uuidstr, sizeof(uuidstr));
ret = virUUIDParse(uuidstr, dom->def->uuid);
if (ret == -1) {
}
static int
-openvzGetVPSUUID(int vpsid, char *uuidstr)
+openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
{
char conf_file[PATH_MAX];
char line[1024];
sscanf(line, "%s %s\n", iden, uuidbuf);
if(STREQ(iden, "#UUID:")) {
- strncpy(uuidstr, uuidbuf, VIR_UUID_STRING_BUFLEN);
+ strncpy(uuidstr, uuidbuf, len);
break;
}
}
if (openvzLocateConfFile(vpsid, conf_file, PATH_MAX, "conf")<0)
return -1;
- if (openvzGetVPSUUID(vpsid, uuidstr))
+ if (openvzGetVPSUUID(vpsid, uuidstr, sizeof(uuidstr)))
return -1;
if (uuidstr[0] == 0) {