Changeset 12388


Ignore:
Timestamp:
06/27/09 20:36:23 (4 years ago)
Author:
BrainSlayer
Message:

check target platform to prevent wrong firmware flashes

Location:
ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_ubnt.c

    r12385 r12388  
    5959        signature_t *sig; 
    6060        fw.size = maxlen; 
     61        if (!strncmp(header->magic, "OPEN", 4) 
     62            && !strncmp(header->magic, "UBNT", 4)) { 
     63                return -1;      //not ubnt firmware 
     64        } 
     65#if defined(CYGPKG_HAL_MIPS_AR2316) 
     66        if (strncmp((unsigned char *)&header->version[4], "ar2316", 6)) { 
     67                diag_printf 
     68                    ("UBNT_FW: cannot upgrade, wrong target platform. only ar2316 is valid"); 
     69                return -1; 
     70        } 
     71#endif 
     72#if defined(CYGPKG_HAL_MIPS_AR5312) 
     73        if (strncmp((unsigned char *)&header->version[4], "ar2313", 6)) { 
     74                diag_printf 
     75                    ("UBNT_FW: cannot upgrade, wrong target platform. only ar2313 is valid"); 
     76                return -1; 
     77        } 
     78#endif 
    6179        if (htonl(crc) != header->crc) { 
    6280                diag_printf("UBNT_FW: header crc failed\n"); 
  • ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_client.c

    r12385 r12388  
    223223                                if (ntohs(hdr->th_opcode) == DATA) { 
    224224                                        if (ntohs(hdr->th_block) == 
    225                                             (cyg_uint16) ((tftp_stream.last_good_block + 1) & 0xFFFF)) { 
     225                                            (cyg_uint16) ((tftp_stream. 
     226                                                           last_good_block + 
     227                                                           1) & 0xFFFF)) { 
    226228                                                // Consume this data 
    227229                                                data_len -= 4;  /* Sizeof TFTP header */ 
  • ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c

    r12385 r12388  
    240240                             sizeof(struct firmware_formats); i++) { 
    241241                                int v = 
    242                                     fw_formats[i]. 
    243                                     fw_check_image((char *)BASE_ADDR, 
    244                                                    ptr - BASE_ADDR, 0) == 0; 
     242                                    fw_formats[i].fw_check_image((char *) 
     243                                                                 BASE_ADDR, 
     244                                                                 ptr - 
     245                                                                 BASE_ADDR, 
     246                                                                 0) == 0; 
    245247                                if (v) { 
    246248                                        detect = i; 
Note: See TracChangeset for help on using the changeset viewer.