Index: redboot/current/ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v retrieving revision 1.192 diff -u -r1.192 ChangeLog --- redboot/current/ChangeLog 19 Apr 2004 21:26:52 -0000 1.192 +++ redboot/current/ChangeLog 23 Apr 2004 19:39:26 -0000 @@ -1,3 +1,13 @@ +2004-04-23 Gary Parnes + + * src/load.c: Certain mixes of build flags could result in + opts[] being too short to handle all of the command line + options, resulting in stack corruption. The size of opts[] + is now tied to the state of the build flags. + + * src/net/tftp_client.c: The port, if specified by the user, + is now corrected for endianness issues. + 2004-04-19 Gary Thomas * src/fs/fileio.c: Can't test for CYGPKG_IO_FLASH_BLOCK_DEVICE without Index: redboot/current/src/load.c =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/src/load.c,v retrieving revision 1.41 diff -u -r1.41 load.c --- redboot/current/src/load.c 18 Mar 2004 14:26:57 -0000 1.41 +++ redboot/current/src/load.c 23 Apr 2004 19:39:26 -0000 @@ -599,7 +599,21 @@ unsigned long end = 0; char type[4]; char *filename = 0; - struct option_info opts[7]; + +#define DEFAULT_OPTION_COUNT 4 + + struct option_info opts[ DEFAULT_OPTION_COUNT + +#if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1 + 1 + +#endif +#ifdef CYGPKG_REDBOOT_NETWORKING + 2 + +#endif +#ifdef CYGBLD_BUILD_REDBOOT_WITH_ZLIB + 1 + +#endif + 0 ]; + connection_info_t info; getc_io_funcs_t *io = NULL; struct load_io_entry *io_tab; @@ -616,6 +630,10 @@ host.sin_port = 0; #endif + /* + * If you add more options, be sure to + * update DEFAULT_OPTION_COUNT and/or opts[] above + */ init_opts(&opts[0], 'v', false, OPTION_ARG_TYPE_FLG, (void *)&verbose, 0, "verbose"); init_opts(&opts[1], 'r', false, OPTION_ARG_TYPE_FLG, @@ -624,7 +642,7 @@ (void *)&base, (bool *)&base_addr_set, "load address"); init_opts(&opts[3], 'm', true, OPTION_ARG_TYPE_STR, (void *)&mode_str, (bool *)&mode_str_set, "download mode (TFTP, xyzMODEM, or disk)"); - num_options = 4; + num_options = DEFAULT_OPTION_COUNT; #if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1 init_opts(&opts[num_options], 'c', true, OPTION_ARG_TYPE_NUM, (void *)&chan, (bool *)&chan_set, "I/O channel"); Index: redboot/current/src/net/tftp_client.c =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/tftp_client.c,v retrieving revision 1.15 diff -u -r1.15 tftp_client.c --- redboot/current/src/net/tftp_client.c 19 Sep 2003 17:11:34 -0000 1.15 +++ redboot/current/src/net/tftp_client.c 23 Apr 2004 19:39:26 -0000 @@ -105,6 +105,8 @@ if (info->server->sin_port == 0) { info->server->sin_port = htons(TFTP_PORT); + } else { + info->server->sin_port = htons(info->server->sin_port); } // Send request - note: RFC 1350 (TFTP rev 2) indicates that this should be