[Skiboot] [PATCH] [leds] Use destination buffer size as bound for	strncpy
    Ananth N Mavinakayanahalli 
    ananth at in.ibm.com
       
    Wed Jun 17 18:33:20 AEST 2015
    
    
  
... instead of potentially unbounded src buffer size
Signed-off-by: Ananth N Mavinakayanahalli <ananth at in.ibm.com>
---
 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;
    
    
More information about the Skiboot
mailing list