diff options
author | Jakob Schlyter <jakob@cvs.openbsd.org> | 2003-11-18 14:14:09 +0000 |
---|---|---|
committer | Jakob Schlyter <jakob@cvs.openbsd.org> | 2003-11-18 14:14:09 +0000 |
commit | a3684c7a7fae3c0a0ad3d9641d29affc2b8aed03 (patch) | |
tree | bd1bf1ed050890b02d624a1468c39c2822f5ce45 /usr.sbin/bind/lib/isc/base64.c | |
parent | 2177e8980dbcbd0b8006b290bb9de8e8565df3ba (diff) |
update to BIND v9.2.3. ok todd@
Diffstat (limited to 'usr.sbin/bind/lib/isc/base64.c')
-rw-r--r-- | usr.sbin/bind/lib/isc/base64.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/bind/lib/isc/base64.c b/usr.sbin/bind/lib/isc/base64.c index f12c4a2d7ef..c6ef07ef5c6 100644 --- a/usr.sbin/bind/lib/isc/base64.c +++ b/usr.sbin/bind/lib/isc/base64.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998-2001 Internet Software Consortium. + * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: base64.c,v 1.23 2001/03/22 00:07:04 bwelling Exp $ */ +/* $ISC: base64.c,v 1.23.2.2 2003/07/22 04:03:47 marka Exp $ */ #include <config.h> @@ -126,6 +126,17 @@ base64_decode_char(base64_decode_ctx_t *ctx, int c) { return (ISC_R_BADBASE64); if (ctx->val[2] == 64 && ctx->val[3] != 64) return (ISC_R_BADBASE64); + /* + * Check that bits that should be zero are. + */ + if (ctx->val[2] == 64 && (ctx->val[1] & 0xf) != 0) + return (ISC_R_BADBASE64); + /* + * We don't need to test for ctx->val[2] != 64 as + * the bottom two bits of 64 are zero. + */ + if (ctx->val[3] == 64 && (ctx->val[2] & 0x3) != 0) + return (ISC_R_BADBASE64); n = (ctx->val[2] == 64) ? 1 : (ctx->val[3] == 64) ? 2 : 3; if (n != 3) { |