[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hurd-bug
Subject:    Re: [PATCH 4/4] xen: fix buffer size
From:       Samuel Thibault <samuel.thibault () gnu ! org>
Date:       2014-02-04 10:54:01
Message-ID: 20140204105401.GE6346 () type ! bordeaux ! inria ! fr
[Download RAW message or body]

Justus Winter, le Tue 04 Feb 2014 11:50:04 +0100, a écrit :
> Previously, only strlen(device_name) bytes were allocated, missing one
> byte for the terminating zero.
> 
> * xen/block.c (hyp_block_init): Fix buffer size.

Ack!

> ---
> 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
> 

-- 
Samuel
<N> je déteste import
<N> parce que lorsque tu fais du python et que tu oublies le #!/bin/env python et que \
tu mets le fichier exécutable <N> import est exécuté
 -+- #ens-mim - pourquoi mon script python change le curseur de la souris ?! -+-


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic