mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 21:47:59 +00:00
2496. [bug] Add sanity length checks to NSID option. [RT #18813]
This commit is contained in:
parent
49960a74b5
commit
81e5de1741
2
CHANGES
2
CHANGES
@ -1,3 +1,5 @@
|
|||||||
|
2496. [bug] Add sanity length checks to NSID option. [RT #18813]
|
||||||
|
|
||||||
2495. [bug] Tighten RRSIG checks. [RT #18795]
|
2495. [bug] Tighten RRSIG checks. [RT #18795]
|
||||||
|
|
||||||
2494. [bug] isc/radix.h, dns/sdlz.h and dns/dlz.h were not being
|
2494. [bug] isc/radix.h, dns/sdlz.h and dns/dlz.h were not being
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: client.c,v 1.258 2008/06/23 19:41:18 jinmei Exp $ */
|
/* $Id: client.c,v 1.259 2008/11/16 20:57:54 marka Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -1222,7 +1222,7 @@ client_addopt(ns_client_t *client) {
|
|||||||
* + 2 bytes for NSID length
|
* + 2 bytes for NSID length
|
||||||
* + NSID itself
|
* + NSID itself
|
||||||
*/
|
*/
|
||||||
char nsid[BUFSIZ];
|
char nsid[BUFSIZ], *nsidp;
|
||||||
isc_buffer_t *buffer = NULL;
|
isc_buffer_t *buffer = NULL;
|
||||||
|
|
||||||
if (ns_g_server->server_usehostname) {
|
if (ns_g_server->server_usehostname) {
|
||||||
@ -1231,19 +1231,19 @@ client_addopt(ns_client_t *client) {
|
|||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
goto no_nsid;
|
goto no_nsid;
|
||||||
}
|
}
|
||||||
} else {
|
nsidp = nsid;
|
||||||
strncpy(nsid, ns_g_server->server_id, sizeof(nsid));
|
} else
|
||||||
}
|
nsidp = ns_g_server->server_id;
|
||||||
|
|
||||||
rdata->length = strlen(nsid) + 4;
|
rdata->length = strlen(nsidp) + 4;
|
||||||
result = isc_buffer_allocate(client->mctx, &buffer,
|
result = isc_buffer_allocate(client->mctx, &buffer,
|
||||||
rdata->length);
|
rdata->length);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto no_nsid;
|
goto no_nsid;
|
||||||
|
|
||||||
isc_buffer_putuint16(buffer, DNS_OPT_NSID);
|
isc_buffer_putuint16(buffer, DNS_OPT_NSID);
|
||||||
isc_buffer_putuint16(buffer, strlen(nsid));
|
isc_buffer_putuint16(buffer, strlen(nsidp));
|
||||||
isc_buffer_putstr(buffer, nsid);
|
isc_buffer_putstr(buffer, nsidp);
|
||||||
rdata->data = buffer->base;
|
rdata->data = buffer->base;
|
||||||
dns_message_takebuffer(client->message, &buffer);
|
dns_message_takebuffer(client->message, &buffer);
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: check.c,v 1.93 2008/09/12 06:02:31 each Exp $ */
|
/* $Id: check.c,v 1.94 2008/11/16 20:57:55 marka Exp $ */
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
@ -792,6 +792,19 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check that server-id is not too long.
|
||||||
|
* 1024 bytes should be big enough.
|
||||||
|
*/
|
||||||
|
obj = NULL;
|
||||||
|
(void)cfg_map_get(options, "server-id", &obj);
|
||||||
|
if (obj != NULL && cfg_obj_isstring(obj) &&
|
||||||
|
strlen(cfg_obj_asstring(obj)) > 1024) {
|
||||||
|
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
|
||||||
|
"'server-id' too big (>1024 bytes)");
|
||||||
|
result = ISC_R_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user