diff options
author | Frank Kühndel <frank.kuehndel@embedded-brains.de> | 2020-10-05 16:28:24 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-10 15:04:15 +0200 |
commit | f28a6defd136ab05473700c7d34845e42a45adf4 (patch) | |
tree | ac037e36e5569be6c917ef2d1c74ae2c847190a1 | |
parent | 0007d65f72f122e8c8c6d8a78e74a5c262ecd604 (diff) |
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
-rw-r--r-- | bsps/shared/dev/display/disp_hcms29xx.c | 7 |
1 files 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); } |