source: rtems/testsuites/sptests/sp13/fillbuff.c @ a841314

4.104.114.84.95
Last change on this file since a841314 was a841314, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 30, 2004 at 7:46:38 PM

2004-03-30 David Querbach <querbach@…>

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.
  • Property mode set to 100644
File size: 811 bytes
Line 
1/*  Fill_buffer
2 *
3 *  This test routine copies a given source string to a given destination
4 *  buffer.
5 *
6 *  Input parameters:
7 *    source - pointer to string to be copied
8 *    buffer - pointer to message buffer to be filled
9 *
10 *  Output parameters:  NONE
11 *
12 *  COPYRIGHT (c) 1989-1999.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23
24void Fill_buffer(
25  char *source,
26  long *buffer
27)
28{
29  char *p;
30  int i, j;
31
32  p = source;
33  for ( i = 0 ; i < MESSAGE_SIZE / sizeof(long) ; i++ ) {
34    buffer[i] = 0;
35    for ( j = sizeof(long) - 1; j >= 0; j-- ) {
36      buffer[i] |= *p++ << (8 * j);
37    }
38  }
39}
Note: See TracBrowser for help on using the repository browser.