+1236. [bug] dns_rdata{class,type}_fromtext() didn't handle non
+ NULL terminated text regions. [RT #2588]
+
1235. [func] Report 'out of memory' errors from openssl.
1234. [bug] contrib/sdb: 'zonetodb' failed to call
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: gen.c,v 1.67 2001/11/27 00:55:52 gson Exp $ */
+/* $Id: gen.c,v 1.68 2002/03/20 17:12:28 marka Exp $ */
#include <config.h>
* Here, walk the list from top to bottom, calculating
* the hash (mod 256) for each name.
*/
- fprintf(stdout, "#define RDATATYPE_COMPARE(_s, _d, _tn, _tp) \\\n");
+ fprintf(stdout, "#define RDATATYPE_COMPARE(_s, _d, _tn, _n, _tp) \\\n");
fprintf(stdout, "\tdo { \\\n");
- fprintf(stdout, "\t\tif (strcasecmp(_s,(_tn)) == 0) { \\\n");
+ fprintf(stdout, "\t\tif (sizeof(_s) - 1 == _n && \\\n"
+ "\t\t strncasecmp(_s,(_tn),"
+ "(sizeof(_s) - 1)) == 0) { \\\n");
fprintf(stdout, "\t\t\tif ((typeattr[_d].flags & "
"DNS_RDATATYPEATTR_RESERVED) != 0) \\\n");
fprintf(stdout, "\t\t\t\treturn (ISC_R_NOTIMPLEMENTED); \\\n");
fprintf(stdout, "\t\t} \\\n");
fprintf(stdout, "\t} while (0)\n\n");
- fprintf(stdout, "#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) "
- "\\\n");
+ fprintf(stdout, "#define RDATATYPE_FROMTEXT_SW(_hash,"
+ "_typename,_length,_typep) \\\n");
fprintf(stdout, "\tswitch (_hash) { \\\n");
for (i = 0; i <= 255; i++) {
ttn = &typenames[i];
if (hash == HASH(ttn2->typename)) {
fprintf(stdout, "\t\t\tRDATATYPE_COMPARE"
"(\"%s\", %u, "
- "_typename, _typep); \\\n",
+ "_typename, _length, _typep); \\\n",
ttn2->typename, j);
ttn2->sorted = 1;
}
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.166 2002/03/17 18:59:43 bwelling Exp $ */
+/* $Id: rdata.c,v 1.167 2002/03/20 17:12:29 marka Exp $ */
#include <config.h>
#include <ctype.h>
*/
COMPARE("ch", dns_rdataclass_chaos);
COMPARE("chaos", dns_rdataclass_chaos);
+
if (source->length > 5 &&
- strncasecmp("class", source->base, 5) == 0)
- {
+ source->length < (5 + sizeof("65000")) &&
+ strncasecmp("class", source->base, 4) == 0) {
+ char buf[sizeof("65000")];
char *endp;
- int val = strtol(source->base + 5, &endp, 10);
+ int val;
+
+ strncpy(buf, source->base + 4, sizeof(buf));
+ buf[sizeof(buf) - 1] = '\0';
+ val = strtol(buf, &endp, 10);
if (*endp == '\0' && val >= 0 && val <= 0xffff) {
*classp = (dns_rdataclass_t)val;
return (ISC_R_SUCCESS);
* to return a result to the caller if it is a valid (known)
* rdatatype name.
*/
- RDATATYPE_FROMTEXT_SW(hash, source->base, typep);
+ RDATATYPE_FROMTEXT_SW(hash, source->base, n, typep);
- if (source->length > 4 && strncasecmp("type", source->base, 4) == 0) {
+ if (source->length > 4 && source->length < (4 + sizeof("65000")) &&
+ strncasecmp("type", source->base, 4) == 0) {
+ char buf[sizeof("65000")];
char *endp;
- int val = strtol(source->base + 4, &endp, 10);
+ int val;
+
+ strncpy(buf, source->base + 4, sizeof(buf));
+ buf[sizeof(buf) - 1] = '\0';
+ val = strtol(buf, &endp, 10);
if (*endp == '\0' && val >= 0 && val <= 0xffff) {
*typep = (dns_rdatatype_t)val;
return (ISC_R_SUCCESS);