mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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:
1 parent
4074e4ebe9
commit
80703daf3e
1 file changed
+1
-1
@@ -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;
|
||||
|
||||