From 6e8b843125f36c702dabd05beb76365ff018f4a4 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Tue, 15 Jan 2002 02:10:10 +0000 Subject: [PATCH] When parsing a hex string of unknown length, properly unget the EOL token at the end. This doesn't affect any existing code, since the one caller passes a known length, but it's still a bug. --- lib/isc/hex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/isc/hex.c b/lib/isc/hex.c index 3b6e4423ea..0131ddc813 100644 --- a/lib/isc/hex.c +++ b/lib/isc/hex.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hex.c,v 1.10 2001/11/27 01:55:58 gson Exp $ */ +/* $Id: hex.c,v 1.11 2002/01/15 02:10:10 bwelling Exp $ */ #include @@ -147,6 +147,8 @@ isc_hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { for (i = 0;i < tr->length; i++) RETERR(hex_decode_char(&ctx, tr->base[i])); } + if (ctx.length < 0) + isc_lex_ungettoken(lexer, &token); RETERR(hex_decode_finish(&ctx)); return (ISC_R_SUCCESS); }