mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Make sure blockId buffer is never overflown (Coverity CID 1149058).
This commit is contained in:
parent
df3e3c7969
commit
99fff91f9d
@ -311,7 +311,10 @@ build_fru_bloc(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id)
|
|||||||
p_new->next = NULL;
|
p_new->next = NULL;
|
||||||
p_new->start = header.offsets[i] * 8;
|
p_new->start = header.offsets[i] * 8;
|
||||||
p_new->size = fru->size - p_new->start;
|
p_new->size = fru->size - p_new->start;
|
||||||
strcpy((char *)p_new->blocId, section_id[i]);
|
|
||||||
|
strncpy((char *)p_new->blocId, section_id[i], sizeof(p_new->blocId));
|
||||||
|
/* Make sure string is null terminated */
|
||||||
|
p_new->blocId[sizeof(p_new->blocId)-1] = 0;
|
||||||
|
|
||||||
p_bloc->next = p_new;
|
p_bloc->next = p_new;
|
||||||
p_bloc->size = p_new->start - p_bloc->start;
|
p_bloc->size = p_new->start - p_bloc->start;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user