diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-01-17 22:12:48 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-01-17 22:12:48 +0000 |
commit | f16c0591a2da67b032ceae2b9dab6b0d86d34dfe (patch) | |
tree | 39874d4c4d5e2d53941ed8b0585f4c0163645723 /cpukit/libmisc/shell/shell_script.c | |
parent | 2011-01-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-f16c0591a2da67b032ceae2b9dab6b0d86d34dfe.tar.bz2 |
2011-01-17 Alin Rus <alin.codejunkie@gmail.com>
* posix/src/aio_cancel.c: Fixed ending of if braces.
2011-01-17 Alin Rus <alin.codejunkie@gmail.com>
* posix/src/aio_misc.c: Add debug information. Fixed idle_threads/
active_threads issues. Fixed infinite loop in rtems_aio_handle().
Diffstat (limited to '')
-rw-r--r-- | cpukit/libmisc/shell/shell_script.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cpukit/libmisc/shell/shell_script.c b/cpukit/libmisc/shell/shell_script.c index 7ff6f816e4..8854f4af35 100644 --- a/cpukit/libmisc/shell/shell_script.c +++ b/cpukit/libmisc/shell/shell_script.c @@ -46,7 +46,8 @@ static void rtems_shell_joel_usage(void) static int findOnPATH( const char *userScriptName, - char *scriptFile + char *scriptFile, + size_t scriptFileLength ) { int sc; @@ -56,7 +57,7 @@ static int findOnPATH( * qualified path name and just use it. */ if ( userScriptName[0] == '/' ) { - strcpy( scriptFile, userScriptName ); + strncpy( scriptFile, userScriptName, PATH_MAX ); } else { /* * For now, the provided name is just turned into a fully @@ -66,11 +67,12 @@ static int findOnPATH( /* XXX should use strncat but what is the limit? */ getcwd( scriptFile, PATH_MAX ); - strcat( scriptFile, "/" ); - strcat( + strncat( scriptFile, "/", PATH_MAX ); + strncat( scriptFile, ( (userScriptName[0] == '.' && userScriptName[1] == '/') ? - &userScriptName[2] : userScriptName) + &userScriptName[2] : userScriptName), + PATH_MAX ); } @@ -187,7 +189,7 @@ int rtems_shell_main_joel( * NOTE: It is terrible that this is done twice but it * seems to be the most expedient thing. */ - sc = findOnPATH( argv[getopt_reent.optind], scriptFile ); + sc = findOnPATH( argv[getopt_reent.optind], scriptFile, PATH_MAX ); if ( sc ) { fprintf( stderr, "%s: command not found\n", argv[0] ); return -1; @@ -258,7 +260,7 @@ int rtems_shell_script_file( /* * Find argv[0] on the path */ - sc = findOnPATH( argv[0], scriptFile ); + sc = findOnPATH( argv[0], scriptFile, PATH_MAX ); if ( sc ) { fprintf( stderr, "%s: command not found\n", argv[0] ); return -1; |