From f28a6defd136ab05473700c7d34845e42a45adf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20K=C3=BChndel?= Date: Mon, 5 Oct 2020 16:28:24 +0200 Subject: 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 --- bsps/shared/dev/display/disp_hcms29xx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bsps/shared/dev/display/disp_hcms29xx.c b/bsps/shared/dev/display/disp_hcms29xx.c index 5730b36ea9..740aa56b8b 100644 --- a/bsps/shared/dev/display/disp_hcms29xx.c +++ b/bsps/shared/dev/display/disp_hcms29xx.c @@ -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); } -- cgit v1.2.3