]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix three cases of comparing pointer to zero char
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Mon, 20 Feb 2017 13:04:06 +0000 (14:04 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 20 Feb 2017 13:55:40 +0000 (08:55 -0500)
Fix three cases of comparing pointer to a zero character, where pointers
were apparently intended to be dereferenced first and then compared.
Found with the help of GCC 7 warnings.

src/main/cond_eval.c
src/modules/rlm_mschap/rlm_mschap.c

index e7d8d6e7cc6aefded96e19dc37ad560b613bc2ca..f50d473eedb0b2d8acc0b9b82d6de051baf76b8f 100644 (file)
@@ -102,7 +102,7 @@ int cond_eval_tmpl(REQUEST *request, int modreturn, UNUSED int depth, vp_tmpl_t
                 *      The VPT *doesn't* have a "bare word" type,
                 *      which arguably it should.
                 */
-               rcode = (vpt->name != '\0');
+               rcode = (*vpt->name != '\0');
                break;
 
        case TMPL_TYPE_ATTR:
index 38709d03595528f7afce6ee48c2dbc3abb0fb097..47c8fab050123325ca84777535ffa5d895b2d1bc 100644 (file)
@@ -439,7 +439,7 @@ static ssize_t mschap_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
                char const *p;
 
                p = fmt + 8;    /* 7 is the length of 'NT-Hash' */
-               if ((p == '\0')  || (outlen <= 32))
+               if ((*p == '\0') || (outlen <= 32))
                        return 0;
 
                while (isspace(*p)) p++;
@@ -462,7 +462,7 @@ static ssize_t mschap_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
                char const *p;
 
                p = fmt + 8;    /* 7 is the length of 'LM-Hash' */
-               if ((p == '\0') || (outlen <= 32))
+               if ((*p == '\0') || (outlen <= 32))
                        return 0;
 
                while (isspace(*p)) p++;