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-Tag: release_3_0_13~25^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1915%2Fhead;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/evaluate.c b/src/main/evaluate.c index 64be4966a45..f01eeec882a 100644 --- a/src/main/evaluate.c +++ b/src/main/evaluate.c @@ -99,7 +99,7 @@ int radius_evaluate_tmpl(REQUEST *request, int modreturn, UNUSED int depth, vp_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 e2d48783720..aba15f826b0 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -436,7 +436,7 @@ static ssize_t mschap_xlat(void *instance, REQUEST *request, 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++; @@ -459,7 +459,7 @@ static ssize_t mschap_xlat(void *instance, REQUEST *request, 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++;