forked from Imagelibrary/rtems
disp_hcms29xx: Fix string truncation warning
The strlcpy() function ensures there is always a NUL character at the end of the string. Hence it is safer as strncpy() and it avoids the compiler warning
This commit is contained in:
committed by
Sebastian Huber
parent
0007d65f72
commit
f28a6defd1
@@ -589,10 +589,9 @@ static rtems_task disp_hcms29xx_update_task
|
||||
RTEMS_WAIT,RTEMS_NO_TIMEOUT);
|
||||
}
|
||||
if (rc == RTEMS_SUCCESSFUL) {
|
||||
strncpy(softc_ptr->disp_param.disp_buffer,
|
||||
softc_ptr->disp_param.trns_buffer,
|
||||
sizeof(softc_ptr->disp_param.disp_buffer));
|
||||
softc_ptr->disp_param.disp_buffer[sizeof(softc_ptr->disp_param.disp_buffer)-1] = '\0';
|
||||
strlcpy(softc_ptr->disp_param.disp_buffer,
|
||||
softc_ptr->disp_param.trns_buffer,
|
||||
sizeof(softc_ptr->disp_param.disp_buffer));
|
||||
softc_ptr->disp_param.disp_buf_cnt =
|
||||
(int) strlen(softc_ptr->disp_param.disp_buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user