freeradius/freeradius-Fix-three-cases-of-comparing-pointer-to-zero-char.patch
Nikolai Kondrashov ad78a601a9 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.
2017-02-20 17:31:10 +01:00

52 lines
1.7 KiB
Diff

From be7f52f986918bf7eac10345304464b2aea54150 Mon Sep 17 00:00:00 2001
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Date: Mon, 20 Feb 2017 14:04:06 +0100
Subject: [PATCH] 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.
---
src/main/evaluate.c | 2 +-
src/modules/rlm_mschap/rlm_mschap.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/evaluate.c b/src/main/evaluate.c
index 64be4966a..f01eeec88 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 3509bd6f5..13d02c539 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++;
--
2.11.0