Changeset b837c83 in rtems


Ignore:
Timestamp:
03/15/22 06:24:55 (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1a5991e
Parents:
f311caf
git-author:
Sebastian Huber <sebastian.huber@…> (03/15/22 06:24:55)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/16/22 06:35:27)
Message:

shell: Avoid potential stack corruption

The rtems_shell_init() passed the address of a stack variable
(exit_code) to rtems_shell_run(). If wait == false, then the stack
variable goes out of scope but may be accessed by the created shell
thread.

The rtems_shell_script() was affected by the same problem.

Close #4629.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/shell.c

    rf311caf rb837c83  
    11501150  bool output_append,
    11511151  rtems_id wake_on_end,
    1152   int *exit_code,
    11531152  bool echo,
    11541153  rtems_shell_login_check_t login_check
     
    12031202  shell_env->parent_stderr = stderr;
    12041203  shell_env->wake_on_end   = wake_on_end;
    1205   shell_env->exit_code     = exit_code;
    12061204  shell_env->login_check   = login_check;
    12071205  shell_env->uid           = getuid();
     
    12301228  }
    12311229
    1232   shell_std_debug("run: end: sc:%d ec:%d\n", sc, *exit_code);
     1230  shell_std_debug("run: end: sc:%d\n", sc);
    12331231
    12341232  return sc;
     
    12461244{
    12471245  rtems_id to_wake = RTEMS_ID_NONE;
    1248   int exit_code = 0;
    12491246
    12501247  if ( wait )
     
    12621259    false,                   /* output_append */
    12631260    to_wake,                 /* wake_on_end */
    1264     &exit_code,              /* exit code of command */
    12651261    false,                   /* echo */
    12661262    login_check              /* login check */
     
    12801276{
    12811277  rtems_id to_wake = RTEMS_ID_NONE;
    1282   int exit_code = 0;
    12831278  rtems_status_code sc;
    12841279
     
    12991294    output_append,   /* output_append */
    13001295    to_wake,         /* wake_on_end */
    1301     &exit_code,      /* exit_code */
    13021296    echo,            /* echo */
    13031297    NULL             /* login check */
Note: See TracChangeset for help on using the changeset viewer.