diff options
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 |
commit | 4ccd2b46975df7b06b9d162fac4ac06dba0bdad4 (patch) | |
tree | da00eb62ec54a9b48e5aafa784fbbabe15654b14 | |
parent | cd98555dfac27c62513862529dc02ead9831ee2b (diff) | |
download | busybox-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.c | 24 |
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 */ |
235 | static char **global_argv; | 235 | static char **global_argv; |
236 | static unsigned int global_argc; | 236 | static int global_argc; |
237 | static unsigned int last_return_code; | 237 | static int last_return_code; |
238 | extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ | 238 | extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ |
239 | 239 | ||
240 | /* "globals" within this file */ | 240 | /* "globals" within this file */ |
241 | static char *ifs; | 241 | static char *ifs; |
242 | static char map[256]; | 242 | static unsigned char map[256]; |
243 | static int fake_mode; | 243 | static int fake_mode; |
244 | static int interactive; | 244 | static int interactive; |
245 | static struct close_me *close_me_head; | 245 | static struct close_me *close_me_head; |
246 | static const char *cwd; | 246 | static const char *cwd; |
247 | static struct pipe *job_list; | 247 | static struct pipe *job_list; |
248 | static unsigned int last_bg_pid; | 248 | static unsigned int last_bg_pid; |
249 | static unsigned int last_jobid; | 249 | static int last_jobid; |
250 | static unsigned int shell_terminal; | 250 | static unsigned int shell_terminal; |
251 | static char *PS1; | 251 | static char *PS1; |
252 | static char *PS2; | 252 | static 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 |
308 | static inline void debug_printf(const char *format, ...) { } | 308 | static 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 */ |
475 | static int builtin_env(struct child_prog *dummy) | 475 | static 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 */ |
607 | static int builtin_help(struct child_prog *dummy) | 607 | static 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 */ |
623 | static int builtin_jobs(struct child_prog *child) | 623 | static 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 */ |
641 | static int builtin_pwd(struct child_prog *dummy) | 641 | static 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) | |||
2457 | int parse_stream(o_string *dest, struct p_context *ctx, | 2457 | int 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 | ||
2617 | static void mapset(const char *set, int code) | 2617 | static 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 | ||
2623 | static void update_ifs_map(void) | 2623 | static void update_ifs_map(void) |