[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] xen: fix buffer size
From: |
Justus Winter |
Subject: |
[PATCH 4/4] xen: fix buffer size |
Date: |
Tue, 4 Feb 2014 11:50:04 +0100 |
Previously, only strlen(device_name) bytes were allocated, missing one
byte for the terminating zero.
* xen/block.c (hyp_block_init): Fix buffer size.
---
xen/block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/block.c b/xen/block.c
index 3e4ce7c..bd3758f 100644
--- a/xen/block.c
+++ b/xen/block.c
@@ -217,7 +217,7 @@ void hyp_block_init(void) {
sprintf(device_name, "%s%ds%d", prefix, disk,
partition);
else
sprintf(device_name, "%s%d", prefix, disk);
- bd->name = (char*) kalloc(strlen(device_name));
+ bd->name = (char*) kalloc(strlen(device_name) + 1);
strcpy(bd->name, device_name);
/* Get domain id of backend driver. */
--
1.8.5.2