From: Shawn Routhier Date: Mon, 28 Nov 2011 18:09:30 +0000 (+0000) Subject: Update code to add a null check for the right hand side X-Git-Tag: v4_2_4b1~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55120d1ad569c71e7ac834d404fa994600370b2c;p=thirdparty%2Fdhcp.git Update code to add a null check for the right hand side --- diff --git a/common/dhcp-eval.5 b/common/dhcp-eval.5 index 5a600b515..8afccfc57 100644 --- a/common/dhcp-eval.5 +++ b/common/dhcp-eval.5 @@ -1,6 +1,6 @@ -.\" $Id: dhcp-eval.5,v 1.29.24.2 2010/07/06 19:03:11 sar Exp $ +.\" $Id: dhcp-eval.5,v 1.29.24.3 2011/11/28 18:09:30 sar Exp $ .\" -.\" Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") .\" Copyright (c) 1996-2003 by Internet Software Consortium .\" @@ -133,8 +133,8 @@ extended regex(7) matching of the values of two data expressions, returning true if \fIdata-expression-1\fR matches against the regular expression evaluated by \fIdata-expression-2\fR, or false if it does not match or encounters some error. If either the left-hand side or the right-hand side -are null, the result is also false. The \fB~~\fR operator differs from the -\fB~=\fR operator in that it is case-insensitive. +are null or empty strings, the result is also false. The \fB~~\fR operator +differs from the \fB~=\fR operator in that it is case-insensitive. .RE .PP .I boolean-expression-1 \fBand\fR \fIboolean-expression-2\fR diff --git a/common/tree.c b/common/tree.c index 20b2bc644..3c978b097 100644 --- a/common/tree.c +++ b/common/tree.c @@ -1120,7 +1120,7 @@ int evaluate_boolean_expression (result, packet, lease, client_state, *result = 0; memset(&re, 0, sizeof(re)); if (bleft && bright && - (left.data != NULL) && + (left.data != NULL) && (right.data != NULL) && (regcomp(&re, (char *)right.data, regflags) == 0) && (regexec(&re, (char *)left.data, (size_t)0, NULL, 0) == 0)) *result = 1;