]> sourceware.org Git - lvm2.git/commitdiff
lvmetad: fix segfault on i386
authorChristian Brauner <christian.brauner@canonical.com>
Sat, 11 Mar 2017 00:08:43 +0000 (01:08 +0100)
committerDavid Teigland <teigland@redhat.com>
Mon, 13 Mar 2017 18:37:07 +0000 (13:37 -0500)
Sending %d as format argument in lvmetad_vg_remove_pending() will cause
segfaults in config_make_nodes_v() when va_arg() casts to int64_t. Also, it is
clearly advertised in the lvm source code that using plain %d is prohibited, so
let's switch to FMTd64.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
lib/cache/lvmetad.c
libdaemon/client/config-util.c

index 8e9bb1fd31349efcaeca62e1a5a223e9610dc791..843e1c3e86e5efb7c409128defe3cd13a6768cbe 100644 (file)
@@ -1304,7 +1304,7 @@ int lvmetad_vg_remove_pending(struct volume_group *vg)
        reply = _lvmetad_send(vg->cmd, "set_vg_info",
                              "name = %s", vg->name,
                              "uuid = %s", uuid,
-                             "version = %d", 0,
+                             "version = %"PRId64, (int64_t)0,
                              NULL);
 
        if (!_lvmetad_handle_reply(reply, "set_vg_info", vg->name, NULL)) {
index 93f3d0a93db401328f1ac99bd980718b5d81d4e8..5b6cfb82aafd1d93654bfe823ccd2d6b21d15621 100644 (file)
@@ -260,7 +260,7 @@ struct dm_config_node *config_make_nodes_v(struct dm_config_tree *cft,
                key[fmt - next] = '\0';
                fmt += 2;
 
-               if (!strcmp(fmt, "%d") || !strcmp(fmt, FMTd64)) {
+               if (!strcmp(fmt, FMTd64)) {
                        int64_t value = va_arg(ap, int64_t);
                        if (!(cn = make_int_node(cft, key, value, parent, pre_sib)))
                                return 0;
This page took 0.039404 seconds and 5 git commands to generate.