libdl: Fix potential overwrite of dest buffer

Update #2843.
This commit is contained in:
Sebastian Huber
2018-01-03 16:09:05 +01:00
parent 87b7117ffd
commit 71a84461d5
2 changed files with 2 additions and 2 deletions

View File

@@ -419,7 +419,7 @@ rtems_rap_get_error (char* message, size_t max_message)
{ {
rtems_rap_data_t* rap = rtems_rap_lock (); rtems_rap_data_t* rap = rtems_rap_lock ();
int last_errno = rap->last_errno; 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 (); rtems_rap_unlock ();
return last_errno; return last_errno;
} }

View File

@@ -44,7 +44,7 @@ rtems_rtl_get_error (char* message, size_t max_message)
if (rtl != NULL) if (rtl != NULL)
{ {
int last_errno = rtl->last_errno; 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 (); rtems_rtl_unlock ();
return last_errno; return last_errno;
} }