mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Only allow hex or decimal when parsing key flags, not octal.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: rdata.c,v 1.165 2002/03/17 18:50:21 bwelling Exp $ */
|
/* $Id: rdata.c,v 1.166 2002/03/17 18:59:43 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -972,7 +972,7 @@ dns_rdatatype_attributes(dns_rdatatype_t type)
|
|||||||
*/
|
*/
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
maybe_numeric(unsigned int *valuep, isc_textregion_t *source,
|
maybe_numeric(unsigned int *valuep, isc_textregion_t *source,
|
||||||
unsigned int base, unsigned int max)
|
unsigned int max, isc_boolean_t hex_allowed)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_uint32_t n;
|
isc_uint32_t n;
|
||||||
@@ -990,7 +990,9 @@ maybe_numeric(unsigned int *valuep, isc_textregion_t *source,
|
|||||||
strncpy(buffer, source->base, NUMBERSIZE);
|
strncpy(buffer, source->base, NUMBERSIZE);
|
||||||
INSIST(buffer[source->length] == '\0');
|
INSIST(buffer[source->length] == '\0');
|
||||||
|
|
||||||
result = isc_parse_uint32(&n, buffer, base);
|
result = isc_parse_uint32(&n, buffer, 10);
|
||||||
|
if (result == ISC_R_BADNUMBER && hex_allowed)
|
||||||
|
result = isc_parse_uint32(&n, buffer, 16);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
if (n > max)
|
if (n > max)
|
||||||
@@ -1006,7 +1008,7 @@ dns_mnemonic_fromtext(unsigned int *valuep, isc_textregion_t *source,
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
result = maybe_numeric(valuep, source, 10, max);
|
result = maybe_numeric(valuep, source, max, ISC_FALSE);
|
||||||
if (result != ISC_R_BADNUMBER)
|
if (result != ISC_R_BADNUMBER)
|
||||||
return (result);
|
return (result);
|
||||||
|
|
||||||
@@ -1288,7 +1290,7 @@ dns_keyflags_fromtext(dns_keyflags_t *flagsp, isc_textregion_t *source)
|
|||||||
char *text, *end;
|
char *text, *end;
|
||||||
unsigned int value, mask;
|
unsigned int value, mask;
|
||||||
|
|
||||||
result = maybe_numeric(&value, source, 0, 0xffff);
|
result = maybe_numeric(&value, source, 0xffff, ISC_TRUE);
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
*flagsp = value;
|
*flagsp = value;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
Reference in New Issue
Block a user