chiark / gitweb /
vol_id: fix ddf version string
authorKarel Zak <kzak@redhat.com>
Fri, 23 Jan 2009 23:37:22 +0000 (00:37 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Sat, 24 Jan 2009 14:20:37 +0000 (15:20 +0100)
The version string in DDF suberblock does not include the null terminator
and the snprintf() function writes at most "size" bytes *including* the
null byte.

old version:
ID_FS_VERSION=02.00.0
new version:
ID_FS_VERSION=02.00.00

Signed-off-by: Karel Zak <kzak@redhat.com>
extras/volume_id/lib/ddf_raid.c

index 58bdae94a734fd378319e9eedd7de35a15c43916..32f20ced49931119487c07748b916775232449dc 100644 (file)
@@ -87,7 +87,7 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size)
        return -1;
 found:
        volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING);
-       snprintf(id->type_version, DDF_REV_LENGTH, "%s", ddf->ddf_rev);
+       snprintf(id->type_version, DDF_REV_LENGTH + 1, "%s", ddf->ddf_rev);
        volume_id_set_usage(id, VOLUME_ID_RAID);
        id->type = "ddf_raid_member";
        return 0;