]> git.proxmox.com Git - pve-cluster.git/commitdiff
fix strtol error check (see manual page)
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 18 Feb 2016 18:09:12 +0000 (19:09 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 18 Feb 2016 18:09:12 +0000 (19:09 +0100)
data/src/memdb.c

index 57c2804462d27f1cd3a9a83d034b22e9bdabe661..560cd4be1c938b3439301eb7ba57431010d29860 100644 (file)
@@ -209,11 +209,15 @@ name_is_vm_config(
        if (!name || name[0] < '1' || name[0] > '9')
                return FALSE;
 
+       
        char *end = NULL;
+
+       errno = 0; /* see man strtoul */
+       
        guint32 vmid =  strtoul(name, &end, 10);
 
        if (!end || end[0] != '.' || end[1] != 'c'|| end[2] != 'o' || end[3] != 'n' ||
-           end[4] != 'f' || end[5] != 0 || errno == ERANGE)
+           end[4] != 'f' || end[5] != 0 || errno != 0)
                return FALSE;
 
        if (vmid_ret)