aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2006-01-31 09:27:48 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2006-01-31 09:27:48 +0000
commit4ccd2b46975df7b06b9d162fac4ac06dba0bdad4 (patch)
treeda00eb62ec54a9b48e5aafa784fbbabe15654b14
parentcd98555dfac27c62513862529dc02ead9831ee2b (diff)
downloadbusybox-w32-4ccd2b46975df7b06b9d162fac4ac06dba0bdad4.tar.gz
busybox-w32-4ccd2b46975df7b06b9d162fac4ac06dba0bdad4.tar.bz2
busybox-w32-4ccd2b46975df7b06b9d162fac4ac06dba0bdad4.zip
quick analize signed->unsigned: protect overflow of map[char], getchar->EOF. Use ATTRIBUTE_UNUSE.
-rw-r--r--shell/hush.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 096b40251..8b6cbe7c9 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -233,20 +233,20 @@ struct variables {
233/* globals, connect us to the outside world 233/* globals, connect us to the outside world
234 * the first three support $?, $#, and $1 */ 234 * the first three support $?, $#, and $1 */
235static char **global_argv; 235static char **global_argv;
236static unsigned int global_argc; 236static int global_argc;
237static unsigned int last_return_code; 237static int last_return_code;
238extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ 238extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */
239 239
240/* "globals" within this file */ 240/* "globals" within this file */
241static char *ifs; 241static char *ifs;
242static char map[256]; 242static unsigned char map[256];
243static int fake_mode; 243static int fake_mode;
244static int interactive; 244static int interactive;
245static struct close_me *close_me_head; 245static struct close_me *close_me_head;
246static const char *cwd; 246static const char *cwd;
247static struct pipe *job_list; 247static struct pipe *job_list;
248static unsigned int last_bg_pid; 248static unsigned int last_bg_pid;
249static unsigned int last_jobid; 249static int last_jobid;
250static unsigned int shell_terminal; 250static unsigned int shell_terminal;
251static char *PS1; 251static char *PS1;
252static char *PS2; 252static char *PS2;
@@ -305,7 +305,7 @@ static void debug_printf(const char *format, ...)
305 va_end(args); 305 va_end(args);
306} 306}
307#else 307#else
308static inline void debug_printf(const char *format, ...) { } 308static inline void debug_printf(const char *format ATTRIBUTE_UNUSED, ...) { }
309#endif 309#endif
310#define final_printf debug_printf 310#define final_printf debug_printf
311 311
@@ -472,7 +472,7 @@ static int builtin_cd(struct child_prog *child)
472} 472}
473 473
474/* built-in 'env' handler */ 474/* built-in 'env' handler */
475static int builtin_env(struct child_prog *dummy) 475static int builtin_env(struct child_prog *dummy ATTRIBUTE_UNUSED)
476{ 476{
477 char **e = environ; 477 char **e = environ;
478 if (e == NULL) return EXIT_FAILURE; 478 if (e == NULL) return EXIT_FAILURE;
@@ -604,7 +604,7 @@ static int builtin_fg_bg(struct child_prog *child)
604} 604}
605 605
606/* built-in 'help' handler */ 606/* built-in 'help' handler */
607static int builtin_help(struct child_prog *dummy) 607static int builtin_help(struct child_prog *dummy ATTRIBUTE_UNUSED)
608{ 608{
609 const struct built_in_command *x; 609 const struct built_in_command *x;
610 610
@@ -620,7 +620,7 @@ static int builtin_help(struct child_prog *dummy)
620} 620}
621 621
622/* built-in 'jobs' handler */ 622/* built-in 'jobs' handler */
623static int builtin_jobs(struct child_prog *child) 623static int builtin_jobs(struct child_prog *child ATTRIBUTE_UNUSED)
624{ 624{
625 struct pipe *job; 625 struct pipe *job;
626 char *status_string; 626 char *status_string;
@@ -638,7 +638,7 @@ static int builtin_jobs(struct child_prog *child)
638 638
639 639
640/* built-in 'pwd' handler */ 640/* built-in 'pwd' handler */
641static int builtin_pwd(struct child_prog *dummy) 641static int builtin_pwd(struct child_prog *dummy ATTRIBUTE_UNUSED)
642{ 642{
643 puts(set_cwd()); 643 puts(set_cwd());
644 return EXIT_SUCCESS; 644 return EXIT_SUCCESS;
@@ -2457,7 +2457,7 @@ int parse_string(o_string *dest, struct p_context *ctx, const char *src)
2457int parse_stream(o_string *dest, struct p_context *ctx, 2457int parse_stream(o_string *dest, struct p_context *ctx,
2458 struct in_str *input, int end_trigger) 2458 struct in_str *input, int end_trigger)
2459{ 2459{
2460 unsigned int ch, m; 2460 int ch, m;
2461 int redir_fd; 2461 int redir_fd;
2462 redir_type redir_style; 2462 redir_type redir_style;
2463 int next; 2463 int next;
@@ -2616,8 +2616,8 @@ int parse_stream(o_string *dest, struct p_context *ctx,
2616 2616
2617static void mapset(const char *set, int code) 2617static void mapset(const char *set, int code)
2618{ 2618{
2619 const char *s; 2619 const unsigned char *s;
2620 for (s=set; *s; s++) map[(int)*s] = code; 2620 for (s = (const unsigned char *)set; *s; s++) map[(int)*s] = code;
2621} 2621}
2622 2622
2623static void update_ifs_map(void) 2623static void update_ifs_map(void)