[hackers] [sbase] Check explicit length in od(1) || FRIGN

From: <git_AT_suckless.org>
Date: Wed, 30 Sep 2015 20:44:17 +0200 (CEST)

commit 0d6d1dc02f6ade56a60337b77d279468d24ba69b
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Tue Sep 29 23:14:59 2015 +0200
Commit: sin <sin_AT_2f30.org>
CommitDate: Wed Sep 30 19:44:10 2015 +0100

    Check explicit length in od(1)
    
    If you pass an empty string, the null-char will always match
    with strchr()!

diff --git a/od.c b/od.c
index b24a279..407f550 100644
--- a/od.c
+++ b/od.c
_AT_@ -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;
Received on Wed Sep 30 2015 - 20:44:17 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 30 2015 - 20:48:24 CEST