From 97e241a3f8a0d7fd2c68303e6c67f653bdd8530d Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 29 Apr 2014 14:33:21 +1000 Subject: [PATCH] 3825. [bug] Address sign extension bug in isc_regex_validate. [RT #35758] (cherry picked from commit c11e46110b2b6236c68d89d4ea557c1d35e5d271) --- CHANGES | 3 +++ lib/isc/regex.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index eea6c7b4a3..fec2bc54f1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3825. [bug] Address sign extension bug in isc_regex_validate. + [RT #35758] + 3824. [bug] A collision between two flag values could cause problems with cache cleaning when SIT was enabled. [RT #35858] diff --git a/lib/isc/regex.c b/lib/isc/regex.c index 279bcdc437..17b3afbe08 100644 --- a/lib/isc/regex.c +++ b/lib/isc/regex.c @@ -220,7 +220,7 @@ isc_regex_validate(const char *c) { ++c; switch (*c) { case '.': /* collating element */ - if (range) --range; + if (range != 0) --range; ++c; state = parse_ce; seen_ce = ISC_FALSE; @@ -255,11 +255,11 @@ isc_regex_validate(const char *c) { default: inside: seen_char = ISC_TRUE; - if (range == 2 && *c < range_start) + if (range == 2 && (*c & 0xff) < range_start) FAIL("out of order range"); if (range != 0) --range; - range_start = *c; + range_start = *c & 0xff; ++c; break; };