xl: use xstrdup in cpurange_parse

This ensures buf is always valid when it is passed to strtok_r.

CID: 1291936

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Wei Liu committed 2016-05-25 14:42:35 +01:00
1 parent 4074e4ebe9
commit 80703daf3e
1 file changed
+1 -1
+1 -1
View File
@@ -847,7 +847,7 @@ static int update_cpumap_range(const char *str, libxl_bitmap *cpumap)
*/
static int cpurange_parse(const char *cpu, libxl_bitmap *cpumap)
{
char *ptr, *saveptr = NULL, *buf = strdup(cpu);
char *ptr, *saveptr = NULL, *buf = xstrdup(cpu);
int rc = 0;
for (ptr = strtok_r(buf, ",", &saveptr); ptr;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.