summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp13/fillbuff.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2004-03-30 19:46:38 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2004-03-30 19:46:38 +0000
commita841314365099df23b3cd1ea7e6c01f8174dda17 (patch)
treec4c17871a212bcc0a071d1ee4fd31c21b44437c5 /testsuites/sptests/sp13/fillbuff.c
parent2004-03-30 David Querbach <querbach@realtime.bc.ca> (diff)
downloadrtems-a841314365099df23b3cd1ea7e6c01f8174dda17.tar.bz2
2004-03-30 David Querbach <querbach@realtime.bc.ca>
PR 595/tests * sp13/fillbuff.c, sp13/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c, sp13/task2.c: Fill_buffer() in fillbuff.c overruns the supplied buffer due to confusion in the definition of MESSAGE_SIZE. Some files in the sp13 test treat MESSAGE_SIZE as a count of bytes, others treat it as a count of longs.
Diffstat (limited to 'testsuites/sptests/sp13/fillbuff.c')
-rw-r--r--testsuites/sptests/sp13/fillbuff.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/testsuites/sptests/sp13/fillbuff.c b/testsuites/sptests/sp13/fillbuff.c
index 6182f5d314..003e5206ed 100644
--- a/testsuites/sptests/sp13/fillbuff.c
+++ b/testsuites/sptests/sp13/fillbuff.c
@@ -21,26 +21,19 @@
#include "system.h"
-#define MESSAGE_SIZE (sizeof(long) * 4)
-
void Fill_buffer(
char *source,
long *buffer
)
{
char *p;
- int i;
-/*
- memcpy( buffer, source, 16 );
-*/
+ int i, j;
+
p = source;
- for ( i=0 ; i<MESSAGE_SIZE ; i++ ) {
- buffer[i] = *p++;
- buffer[i] <<= 8;
- buffer[i] |= *p++;
- buffer[i] <<= 8;
- buffer[i] |= *p++;
- buffer[i] <<= 8;
- buffer[i] |= *p++;
+ for ( i = 0 ; i < MESSAGE_SIZE / sizeof(long) ; i++ ) {
+ buffer[i] = 0;
+ for ( j = sizeof(long) - 1; j >= 0; j-- ) {
+ buffer[i] |= *p++ << (8 * j);
+ }
}
}