]> git.hungrycats.org Git - linux/commitdiff
[PATCH] dm-ioctl.c: fix off-by-one error
authorAndrew Morton <akpm@osdl.org>
Sat, 29 May 2004 03:56:58 +0000 (20:56 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 29 May 2004 03:56:58 +0000 (20:56 -0700)
From: Kevin Corry <kevcorry@us.ibm.com>

Fix an OB1 error when calculating an output buffer size, that could cause a
missing null termininator in the 'list devices' ioctl results.  [Steffan
Paletta]

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-ioctl.c

index 26e07286e21f83da1715df5f99feea067c2feb43..814633226065bb00e401fa00b5c313b9fb59b2c0 100644 (file)
@@ -377,7 +377,7 @@ static int list_devices(struct dm_ioctl *param, size_t param_size)
        for (i = 0; i < NUM_BUCKETS; i++) {
                list_for_each_entry (hc, _name_buckets + i, name_list) {
                        needed += sizeof(struct dm_name_list);
-                       needed += strlen(hc->name);
+                       needed += strlen(hc->name) + 1;
                        needed += ALIGN_MASK;
                }
        }