From: Aschref Ben Thabet <aschref.ben-tha...@embedded-brains.de>

strncpy is unsafe if the terminating NULL is missing, as it may copy
more characters than fit in the destination area

Replace it by the safer strlcpy() and fix the string
turncation warnings.
---
 bsps/shared/dev/display/disp_hcms29xx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bsps/shared/dev/display/disp_hcms29xx.c 
b/bsps/shared/dev/display/disp_hcms29xx.c
index 5730b36ea9..fb88f66343 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,
+       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_buffer[sizeof(softc_ptr->disp_param.disp_buffer)-1] 
= '\0';
        softc_ptr->disp_param.disp_buf_cnt =
          (int) strlen(softc_ptr->disp_param.disp_buffer);
       }
-- 
2.26.2

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to