aboutsummaryrefslogtreecommitdiff
path: root/shell/builtin_read.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/builtin_read.c')
-rw-r--r--shell/builtin_read.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/shell/builtin_read.c b/shell/builtin_read.c
index 73b0949cf..954e4cd14 100644
--- a/shell/builtin_read.c
+++ b/shell/builtin_read.c
@@ -39,6 +39,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
39 unsigned end_ms; /* -t TIMEOUT */ 39 unsigned end_ms; /* -t TIMEOUT */
40 int fd; /* -u FD */ 40 int fd; /* -u FD */
41 int nchars; /* -n NUM */ 41 int nchars; /* -n NUM */
42 char **pp;
42 char *buffer; 43 char *buffer;
43 struct termios tty, old_tty; 44 struct termios tty, old_tty;
44 const char *retval; 45 const char *retval;
@@ -46,6 +47,16 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
46 int startword; 47 int startword;
47 smallint backslash; 48 smallint backslash;
48 49
50 pp = argv;
51 while (*pp) {
52 if (!is_well_formed_var_name(*pp, '\0')) {
53 /* Mimic bash message */
54 bb_error_msg("read: '%s': not a valid identifier", *pp);
55 return (const char *)(uintptr_t)1;
56 }
57 pp++;
58 }
59
49 nchars = 0; /* if != 0, -n is in effect */ 60 nchars = 0; /* if != 0, -n is in effect */
50 if (opt_n) { 61 if (opt_n) {
51 nchars = bb_strtou(opt_n, NULL, 10); 62 nchars = bb_strtou(opt_n, NULL, 10);