[PATCH] vol_id: fix ddf version string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 extras/volume_id/lib/ddf_raid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c
index 58bdae9..32f20ce 100644
--- a/extras/volume_id/lib/ddf_raid.c
+++ b/extras/volume_id/lib/ddf_raid.c
@@ -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;
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux