mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
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
This commit is contained in:
parent
eeb06bf230
commit
9c83e83628
@ -155,13 +155,13 @@ static const char * const add_strings[] = {
|
|||||||
"4/4 \" %011o \" \"\\n\"", /* O */
|
"4/4 \" %011o \" \"\\n\"", /* O */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const signed char od_opts[] = "aBbcDdeFfHhIiLlOovXx";
|
static const signed char od_opts[] = "aBbcDdeFfHhIiLlOoXxv";
|
||||||
|
|
||||||
static const signed char od_o2si[] = {
|
static const signed char od_o2si[] = {
|
||||||
0, 1, 2, 3, 5,
|
0, 1, 2, 3, 5,
|
||||||
4, 6, 6, 7, 8,
|
4, 6, 6, 7, 8,
|
||||||
9, 0xa, 0xb, 0xa, 0xa,
|
9, 0xa, 0xb, 0xa, 0xa,
|
||||||
0xb, 1, -1, 8, 9,
|
0xb, 1, 8, 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
int od_main(int argc, char **argv)
|
int od_main(int argc, char **argv)
|
||||||
@ -173,7 +173,9 @@ int od_main(int argc, char **argv)
|
|||||||
bb_dump_length = -1;
|
bb_dump_length = -1;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, od_opts)) > 0) {
|
while ((ch = getopt(argc, argv, od_opts)) > 0) {
|
||||||
if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) {
|
if (ch == 'v') {
|
||||||
|
bb_dump_vflag = ALL;
|
||||||
|
} else if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = 0;
|
first = 0;
|
||||||
bb_dump_add("\"%07.7_Ao\n\"");
|
bb_dump_add("\"%07.7_Ao\n\"");
|
||||||
@ -182,8 +184,6 @@ int od_main(int argc, char **argv)
|
|||||||
bb_dump_add("\" \"");
|
bb_dump_add("\" \"");
|
||||||
}
|
}
|
||||||
bb_dump_add(add_strings[od_o2si[(int)(p-od_opts)]]);
|
bb_dump_add(add_strings[od_o2si[(int)(p-od_opts)]]);
|
||||||
} else if (ch == 'v') {
|
|
||||||
bb_dump_vflag = ALL;
|
|
||||||
} else { /* P, p, s, w, or other unhandled */
|
} else { /* P, p, s, w, or other unhandled */
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user