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.
This commit is contained in:
Nikolai Kondrashov 2017-02-20 17:31:10 +01:00
parent afbec7d303
commit ad78a601a9
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,51 @@
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

View File

@ -1,7 +1,7 @@
Summary: High-performance and highly configurable free RADIUS server
Name: freeradius
Version: 3.0.12
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+ and LGPLv2+
Group: System Environment/Daemons
URL: http://www.freeradius.org/
@ -23,6 +23,7 @@ Source104: freeradius-tmpfiles.conf
Patch1: freeradius-redhat-config.patch
Patch2: freeradius-Use-system-crypto-policy-by-default.patch
Patch3: freeradius-Fix-three-cases-of-comparing-pointer-to-zero-char.patch
%global docdir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
@ -190,6 +191,7 @@ This plugin provides the REST support for the FreeRADIUS server project.
# mistakenly includes the backup files, especially problematic for raddb config files.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
# Force compile/link options, extra security for network facing daemon
@ -791,6 +793,9 @@ exit 0
%attr(640,root,radiusd) %config(noreplace) /etc/raddb/mods-available/rest
%changelog
* Mon Feb 20 2017 Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> - 3.0.12-2
- Fix three cases of comparing pointers to zero characters
* Fri Feb 17 2017 Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> - 3.0.12-1
- Upgrade to upstream v3.0.12 release.
See upstream ChangeLog for details (in freeradius-doc subpackage).