Changeset 4d111157 in rtems


Ignore:
Timestamp:
Aug 28, 2007, 2:03:52 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
81cd377
Parents:
d7d5363b
Message:

2007-08-28 Joel Sherrill <joel.sherrill@…>

PR 1256/networking

  • ftpd/ftpd.c, sapi/src/io.c: Fix unaligned access.
Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rd7d5363b r4d111157  
     12007-08-28      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        PR 1256/networking
     4        * ftpd/ftpd.c, sapi/src/io.c: Fix unaligned access.
     5
    162007-07-31      Joel Sherrill <joel.sherrill@OARcorp.com>
    27
  • cpukit/ftpd/ftpd.c

    rd7d5363b r4d111157  
    14331433  {
    14341434    int i;
    1435     uint8_t b[NUM_FIELDS];
     1435    union {
     1436      uint8_t b[NUM_FIELDS];
     1437      struct {
     1438        uint32_t ip;
     1439        uint16_t port;
     1440      };
     1441    } ip_info;
    14361442
    14371443    for(i = 0; i < NUM_FIELDS; ++i)
     
    14391445      if(a[i] > 255)
    14401446        break;
    1441       b[i] = (uint8_t)a[i];
     1447      ip_info.b[i] = (uint8_t)a[i];
    14421448    }
    14431449
     
    14471453       * to specify IP address different than those of the originating client
    14481454       * for the sake of safety. */
    1449       uint32_t const *ip   = (uint32_t *)b;
    1450       if(*ip == info->def_addr.sin_addr.s_addr)
     1455      if (ip_info.ip == info->def_addr.sin_addr.s_addr)
    14511456      {
    1452         info->data_addr.sin_addr.s_addr = *ip;
    1453         info->data_addr.sin_port        = *(uint16_t *)(b + 4);
     1457        info->data_addr.sin_addr.s_addr = ip_info.ip;
     1458        info->data_addr.sin_port        = ip_info.port;
    14541459        info->data_addr.sin_family      = AF_INET;
    14551460        memset(info->data_addr.sin_zero, 0, sizeof(info->data_addr.sin_zero));
  • cpukit/sapi/src/io.c

    rd7d5363b r4d111157  
    137137    if ( major == 0 )
    138138    {
     139        bool found = FALSE;
    139140        for ( major = _IO_Number_of_drivers - 1 ; major ; major-- )
    140141            if ( _IO_Driver_address_table[major].initialization_entry == 0 &&
    141                  _IO_Driver_address_table[major].open_entry == 0 )
     142                 _IO_Driver_address_table[major].open_entry == 0 ) {
     143                found = FALSE;
    142144                break;
    143 
    144         if (( major == 0 ) &&
    145             ( _IO_Driver_address_table[major].initialization_entry == 0 &&
    146               _IO_Driver_address_table[major].open_entry == 0 ))
    147             return RTEMS_TOO_MANY;
     145            }
     146
     147        if ( !found )
     148          return RTEMS_TOO_MANY;
    148149    }
    149150
Note: See TracChangeset for help on using the changeset viewer.