[rtems commit] psxthreadname01: Fix out of bounds memory access
Sebastian Huber
sebh at rtems.org
Tue Jul 24 12:37:15 UTC 2018
Module: rtems
Branch: master
Commit: bded3f05f8c5d63f7db5e1dda10e9fb318f4d5d2
Changeset: http://git.rtems.org/rtems/commit/?id=bded3f05f8c5d63f7db5e1dda10e9fb318f4d5d2
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Jul 24 12:46:32 2018 +0200
psxthreadname01: Fix out of bounds memory access
---
testsuites/psxtests/psxthreadname01/init.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/testsuites/psxtests/psxthreadname01/init.c b/testsuites/psxtests/psxthreadname01/init.c
index 20bac23..0269e97 100644
--- a/testsuites/psxtests/psxthreadname01/init.c
+++ b/testsuites/psxtests/psxthreadname01/init.c
@@ -35,7 +35,7 @@ static void test(void)
char name[sizeof(big_name)];
int eno;
- memcpy(name, no_name, sizeof(name));
+ memcpy(name, no_name, sizeof(no_name));
eno = pthread_getname_np(0xffffffff, name, MAX_NAME_SIZE);
rtems_test_assert(eno == ESRCH);
rtems_test_assert(strcmp(name, "") == 0);
@@ -43,12 +43,12 @@ static void test(void)
eno = pthread_setname_np(0xffffffff, name);
rtems_test_assert(eno == ESRCH);
- memcpy(name, no_name, sizeof(name));
+ memcpy(name, no_name, sizeof(no_name));
eno = pthread_getname_np(pthread_self(), name, 0);
rtems_test_assert(eno == ERANGE);
rtems_test_assert(strcmp(name, "NO") == 0);
- memcpy(name, no_name, sizeof(name));
+ memcpy(name, no_name, sizeof(no_name));
eno = pthread_getname_np(pthread_self(), name, sizeof(name));
rtems_test_assert(eno == 0);
rtems_test_assert(strcmp(name, "UI1 ") == 0);
@@ -56,7 +56,7 @@ static void test(void)
eno = pthread_setname_np(pthread_self(), big_name);
rtems_test_assert(eno == ERANGE);
- memcpy(name, no_name, sizeof(name));
+ memcpy(name, no_name, sizeof(no_name));
eno = pthread_getname_np(pthread_self(), name, sizeof(name));
rtems_test_assert(eno == 0);
rtems_test_assert(strcmp(name, "abcdefghijkl") == 0);
@@ -64,12 +64,12 @@ static void test(void)
eno = pthread_setname_np(pthread_self(), new_name);
rtems_test_assert(eno == 0);
- memcpy(name, no_name, sizeof(name));
+ memcpy(name, no_name, sizeof(no_name));
eno = pthread_getname_np(pthread_self(), name, sizeof(name));
rtems_test_assert(eno == 0);
rtems_test_assert(strcmp(name, "new") == 0);
- memcpy(name, no_name, sizeof(name));
+ memcpy(name, no_name, sizeof(no_name));
eno = pthread_getname_np(pthread_self(), name, 3);
rtems_test_assert(eno == ERANGE);
rtems_test_assert(strcmp(name, "ne") == 0);
More information about the vc
mailing list