summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamalesh Babulal <kamalesh@linux.vnet.ibm.com>2015-06-23 14:07:32 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-06-24 16:19:43 +1000
commite5b053749e75e959aa5cafc875327b66f571e73a (patch)
tree975958563f8dfec8acbf172bd5f911ccda1bf198
parent7f3f03547fa8b2225dd70e49efdedcd7cb585744 (diff)
downloadblackbird-skiboot-e5b053749e75e959aa5cafc875327b66f571e73a.tar.gz
blackbird-skiboot-e5b053749e75e959aa5cafc875327b66f571e73a.zip
queue_led_state_change() - Fix unterminated string warning
struct led_set_cmd cmd is zalloc. While doing strncpy of loc_code to cmd->loc_code, there are chances of cmd->loc_code being unterminated. Fix the issue by copying LOC_CODE_SIZE - 1. Fixes Coverity defect #100249. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/fsp/fsp-leds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index 82be37a6..877aca1a 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, LOC_CODE_SIZE);
+ strncpy(cmd->loc_code, loc_code, LOC_CODE_SIZE - 1);
cmd->command = command;
cmd->state = state;
cmd->cmd_src = cmd_src;
OpenPOWER on IntegriCloud