[Skiboot] [PATCH] [leds] Use destination buffer size as bound for strncpy

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Jun 18 15:32:19 AEST 2015


On 06/17/2015 02:03 PM, Ananth N Mavinakayanahalli wrote:
> ... instead of potentially unbounded src buffer size
> 
> Signed-off-by: Ananth N Mavinakayanahalli <ananth at in.ibm.com>

Makes sense..

Reviewed-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>

-Vasant

> ---
>  hw/fsp/fsp-leds.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
> index eef932c..82be37a 100644
> --- a/hw/fsp/fsp-leds.c
> +++ b/hw/fsp/fsp-leds.c
> @@ -683,7 +683,7 @@ static int queue_led_state_change(char *loc_code, u8 command,
>  	}
>  
>  	/* Save the request */
> -	strncpy(cmd->loc_code, loc_code, strlen(loc_code));
> +	strncpy(cmd->loc_code, loc_code, LOC_CODE_SIZE);
>  	cmd->command = command;
>  	cmd->state = state;
>  	cmd->cmd_src = cmd_src;
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
> 



More information about the Skiboot mailing list