Fix parse strlen() bug
authorJens Axboe <jens.axboe@oracle.com>
Fri, 5 Mar 2010 11:46:37 +0000 (12:46 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 5 Mar 2010 11:46:37 +0000 (12:46 +0100)
Commit 38789b58775ee5e00f4669f01b3c9da31a7345e3 checks the wrong
string, it's unitialized garbage.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
parse.c

diff --git a/parse.c b/parse.c
index d8527b50d8877b8644529d4764bc374522a070bc..9e3c5b17e6707ae0da22a5c8791d7d20a957a1f4 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -658,7 +658,7 @@ static char *option_dup_subs(const char *opt)
        ssize_t nchr = OPT_LEN_MAX;
        size_t envlen;
 
        ssize_t nchr = OPT_LEN_MAX;
        size_t envlen;
 
-       if (strlen(in) + 1 > OPT_LEN_MAX) {
+       if (strlen(opt) + 1 > OPT_LEN_MAX) {
                fprintf(stderr, "OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
                return NULL;
        }
                fprintf(stderr, "OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
                return NULL;
        }