aboutsummaryrefslogtreecommitdiff
path: root/coreutils/od.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2004-07-23 01:42:28 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2004-07-23 01:42:28 +0000
commit9c83e836281e75b9c4be3906d74d62f2f94a94ea (patch)
tree3ff814899b7107ae10b651c8c487ae68c2871294 /coreutils/od.c
parenteeb06bf230103440f96e4d42d869f2f3a70d869a (diff)
downloadbusybox-w32-9c83e836281e75b9c4be3906d74d62f2f94a94ea.tar.gz
busybox-w32-9c83e836281e75b9c4be3906d74d62f2f94a94ea.tar.bz2
busybox-w32-9c83e836281e75b9c4be3906d74d62f2f94a94ea.zip
Felipe Kellermann writes,
"As noticed today by Steven Scholz, the od's `-v' was broken. I've fixed that and now both the flags `-v' and `-a' are OK" Fixes a segfault in echo "uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu\02bar\4"| ./busybox od -av
Diffstat (limited to 'coreutils/od.c')
-rw-r--r--coreutils/od.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/od.c b/coreutils/od.c
index b18c53c3f..6a138e838 100644
--- a/coreutils/od.c
+++ b/coreutils/od.c
@@ -155,13 +155,13 @@ static const char * const add_strings[] = {
155 "4/4 \" %011o \" \"\\n\"", /* O */ 155 "4/4 \" %011o \" \"\\n\"", /* O */
156}; 156};
157 157
158static const signed char od_opts[] = "aBbcDdeFfHhIiLlOovXx"; 158static const signed char od_opts[] = "aBbcDdeFfHhIiLlOoXxv";
159 159
160static const signed char od_o2si[] = { 160static const signed char od_o2si[] = {
161 0, 1, 2, 3, 5, 161 0, 1, 2, 3, 5,
162 4, 6, 6, 7, 8, 162 4, 6, 6, 7, 8,
163 9, 0xa, 0xb, 0xa, 0xa, 163 9, 0xa, 0xb, 0xa, 0xa,
164 0xb, 1, -1, 8, 9, 164 0xb, 1, 8, 9,
165}; 165};
166 166
167int od_main(int argc, char **argv) 167int od_main(int argc, char **argv)
@@ -173,7 +173,9 @@ int od_main(int argc, char **argv)
173 bb_dump_length = -1; 173 bb_dump_length = -1;
174 174
175 while ((ch = getopt(argc, argv, od_opts)) > 0) { 175 while ((ch = getopt(argc, argv, od_opts)) > 0) {
176 if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) { 176 if (ch == 'v') {
177 bb_dump_vflag = ALL;
178 } else if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) {
177 if (first) { 179 if (first) {
178 first = 0; 180 first = 0;
179 bb_dump_add("\"%07.7_Ao\n\""); 181 bb_dump_add("\"%07.7_Ao\n\"");
@@ -182,8 +184,6 @@ int od_main(int argc, char **argv)
182 bb_dump_add("\" \""); 184 bb_dump_add("\" \"");
183 } 185 }
184 bb_dump_add(add_strings[od_o2si[(int)(p-od_opts)]]); 186 bb_dump_add(add_strings[od_o2si[(int)(p-od_opts)]]);
185 } else if (ch == 'v') {
186 bb_dump_vflag = ALL;
187 } else { /* P, p, s, w, or other unhandled */ 187 } else { /* P, p, s, w, or other unhandled */
188 bb_show_usage(); 188 bb_show_usage();
189 } 189 }