Check explicit length in od(1)
If you pass an empty string, the null-char will always match with strchr()!
This commit is contained in:
parent
d49bce7fc8
commit
0d6d1dc02f
4
od.c
4
od.c
|
@ -108,13 +108,13 @@ main(int argc, char *argv[])
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'A':
|
case 'A':
|
||||||
s = EARGF(usage());
|
s = EARGF(usage());
|
||||||
if (strlen(s) > 1 || !strchr("doxn", s[0]))
|
if (strlen(s) != 1 || !strchr("doxn", s[0]))
|
||||||
usage();
|
usage();
|
||||||
radix = s[0];
|
radix = s[0];
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
s = EARGF(usage());
|
s = EARGF(usage());
|
||||||
if (strlen(s) > 1 || !strchr("acdoux", s[0]))
|
if (strlen(s) != 1 || !strchr("acdoux", s[0]))
|
||||||
usage();
|
usage();
|
||||||
type = s[0];
|
type = s[0];
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user