From: Nikolai Kondrashov Date: Mon, 20 Feb 2017 13:04:06 +0000 (+0100) Subject: Fix three cases of comparing pointer to zero char X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbf99bda0984c25ff2dbd27675ee75394987c6be;p=thirdparty%2Ffreeradius-server.git Fix three cases of comparing pointer to zero char 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. --- diff --git a/src/main/cond_eval.c b/src/main/cond_eval.c index e7d8d6e7cc6..f50d473eedb 100644 --- a/src/main/cond_eval.c +++ b/src/main/cond_eval.c @@ -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: diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index 38709d03595..47c8fab0501 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -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++;