File bind-CVE-2017-3138.patch of Package bind.4592
Index: bind-9.9.9-P1/bin/tests/system/rndc/tests.sh
===================================================================
--- bind-9.9.9-P1.orig/bin/tests/system/rndc/tests.sh
+++ bind-9.9.9-P1/bin/tests/system/rndc/tests.sh
@@ -297,5 +297,13 @@ sleep 1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
+n=`expr $n + 1`
+echo "I:check 'rndc \"\"' is handled ($n)"
+ret=0
+$RNDCCMD "" > rndc.out.test$n 2>&1 && ret=1
+grep "rndc: '' failed: failure" rndc.out.test$n > /dev/null
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
echo "I:exit status: $status"
exit $status
Index: bind-9.9.9-P1/lib/isc/include/isc/lex.h
===================================================================
--- bind-9.9.9-P1.orig/lib/isc/include/isc/lex.h
+++ bind-9.9.9-P1/lib/isc/include/isc/lex.h
@@ -152,8 +152,6 @@ isc_lex_create(isc_mem_t *mctx, size_t m
* Requires:
*\li '*lexp' is a valid lexer.
*
- *\li max_token > 0.
- *
* Ensures:
*\li On success, *lexp is attached to the newly created lexer.
*
Index: bind-9.9.9-P1/lib/isc/lex.c
===================================================================
--- bind-9.9.9-P1.orig/lib/isc/lex.c
+++ bind-9.9.9-P1/lib/isc/lex.c
@@ -94,9 +94,10 @@ isc_lex_create(isc_mem_t *mctx, size_t m
/*
* Create a lexer.
*/
-
REQUIRE(lexp != NULL && *lexp == NULL);
- REQUIRE(max_token > 0U);
+
+ if (max_token == 0U)
+ max_token = 1;
lex = isc_mem_get(mctx, sizeof(*lex));
if (lex == NULL)