commit 0d6d1dc02f6ade56a60337b77d279468d24ba69b
parent d49bce7fc8208551e27833954badaa4bef50156f
Author: FRIGN <dev@frign.de>
Date: Tue, 29 Sep 2015 23:14:59 +0200
Check explicit length in od(1)
If you pass an empty string, the null-char will always match
with strchr()!
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/od.c b/od.c
@@ -108,13 +108,13 @@ main(int argc, char *argv[])
ARGBEGIN {
case 'A':
s = EARGF(usage());
- if (strlen(s) > 1 || !strchr("doxn", s[0]))
+ if (strlen(s) != 1 || !strchr("doxn", s[0]))
usage();
radix = s[0];
break;
case 't':
s = EARGF(usage());
- if (strlen(s) > 1 || !strchr("acdoux", s[0]))
+ if (strlen(s) != 1 || !strchr("acdoux", s[0]))
usage();
type = s[0];
break;