[PATCH 08/11] libdl: Fix potential overwrite of dest buffer
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Feb 6 15:51:26 UTC 2018
Update #2843.
---
cpukit/libdl/rap.c | 2 +-
cpukit/libdl/rtl-error.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpukit/libdl/rap.c b/cpukit/libdl/rap.c
index c512571ac8..bb42072b21 100644
--- a/cpukit/libdl/rap.c
+++ b/cpukit/libdl/rap.c
@@ -419,7 +419,7 @@ rtems_rap_get_error (char* message, size_t max_message)
{
rtems_rap_data_t* rap = rtems_rap_lock ();
int last_errno = rap->last_errno;
- strncpy (message, rap->last_error, sizeof (rap->last_error));
+ strlcpy (message, rap->last_error, max_message);
rtems_rap_unlock ();
return last_errno;
}
diff --git a/cpukit/libdl/rtl-error.c b/cpukit/libdl/rtl-error.c
index 449beb5141..5638b88705 100644
--- a/cpukit/libdl/rtl-error.c
+++ b/cpukit/libdl/rtl-error.c
@@ -44,7 +44,7 @@ rtems_rtl_get_error (char* message, size_t max_message)
if (rtl != NULL)
{
int last_errno = rtl->last_errno;
- strncpy (message, rtl->last_error, sizeof (rtl->last_error));
+ strlcpy (message, rtl->last_error, max_message);
rtems_rtl_unlock ();
return last_errno;
}
--
2.12.3
More information about the devel
mailing list