Commit Diff
Diff:
a86cc58a0b93976e62fddf326650d42bc058f888
82b9ddd092c7cf5c1dfe65dae96f4d065c3b1697
Commit:
82b9ddd092c7cf5c1dfe65dae96f4d065c3b1697
Tree:
f33b9ae28874287671a3b360542b8b5bb063286f
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Thu Jan 16 13:29:03 2020 UTC
Message:
pass the size of the replystring in lookup_zone() as an argument, this way we don't have to track what replystring's size was
blob - cd80deb9746a8497b7c0d5e157e696a264b6f922
blob + e3db6e7902e01d792a4274903a15d8481c7b7ea0
--- delphinusdnsd.c
+++ delphinusdnsd.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: delphinusdnsd.c,v 1.98 2020/01/14 12:42:04 pjp Exp $
+ * $Id: delphinusdnsd.c,v 1.99 2020/01/16 13:29:03 pjp Exp $
*/
@@ -123,7 +123,7 @@ extern void init_filter(void);
extern void init_whitelist(void);
extern void init_tsig(void);
extern void init_notifyslave(void);
-extern struct rbtree * lookup_zone(ddDB *, struct question *, int *, int *, char *);
+extern struct rbtree * lookup_zone(ddDB *, struct question *, int *, int *, char *, int);
extern struct rbtree * Lookup_zone(ddDB *, char *, u_int16_t, u_int16_t, int);
extern int memcasecmp(u_char *, u_char *, int);
extern int reply_a(struct sreply *, ddDB *);
@@ -1898,7 +1898,7 @@ axfrentry:
fakequestion = NULL;
- rbt0 = lookup_zone(cfg->db, question, &type0, &lzerrno, (char *)&replystring);
+ rbt0 = lookup_zone(cfg->db, question, &type0, &lzerrno, (char *)&replystring, sizeof(replystring));
if (type0 < 0) {
switch (lzerrno) {
default:
@@ -2020,7 +2020,7 @@ axfrentry:
break;
}
- rbt1 = lookup_zone(cfg->db, fakequestion, &type1, &lzerrno, (char *)&fakereplystring);
+ rbt1 = lookup_zone(cfg->db, fakequestion, &type1, &lzerrno, (char *)&fakereplystring, sizeof(fakereplystring));
/* break CNAMES pointing to CNAMES */
if (type1 == DNS_TYPE_CNAME)
type1 = 0;
@@ -2866,7 +2866,7 @@ tcploop(struct cfg *cfg, struct imsgbuf **ibuf)
goto tcpout;
}
- rbt0 = lookup_zone(cfg->db, question, &type0, &lzerrno, (char *)&replystring);
+ rbt0 = lookup_zone(cfg->db, question, &type0, &lzerrno, (char *)&replystring, sizeof(replystring));
if (type0 < 0) {
switch (lzerrno) {
@@ -2988,7 +2988,7 @@ tcploop(struct cfg *cfg, struct imsgbuf **ibuf)
break;
}
- rbt1 = lookup_zone(cfg->db, fakequestion, &type1, &lzerrno, (char *)&fakereplystring);
+ rbt1 = lookup_zone(cfg->db, fakequestion, &type1, &lzerrno, (char *)&fakereplystring, sizeof(fakereplystring));
/* break CNAMES pointing to CNAMES */
if (type1 == DNS_TYPE_CNAME)
type1 = 0;
blob - 9c30404732badf26648752751218925af1a7f256
blob + 00d37bab3f8bced0760ca67939ccb890ee0cd1db
--- util.c
+++ util.c
@@ -27,7 +27,7 @@
*/
/*
- * $Id: util.c,v 1.58 2019/12/11 16:22:26 pjp Exp $
+ * $Id: util.c,v 1.59 2020/01/16 13:29:03 pjp Exp $
*/
#include <sys/types.h>
@@ -97,7 +97,7 @@ void slave_shutdown(void);
int get_record_size(ddDB *, char *, int);
struct rbtree * get_soa(ddDB *, struct question *);
struct rbtree * get_ns(ddDB *, struct rbtree *, int *);
-struct rbtree * lookup_zone(ddDB *, struct question *, int *, int *, char *);
+struct rbtree * lookup_zone(ddDB *, struct question *, int *, int *, char *, int);
struct rbtree * Lookup_zone(ddDB *, char *, u_int16_t, u_int16_t, int);
u_int16_t check_qtype(struct rbtree *, u_int16_t, int, int *);
struct question *build_fake_question(char *, int, u_int16_t, char *, int);
@@ -344,7 +344,7 @@ slave_shutdown(void)
struct rbtree *
-lookup_zone(ddDB *db, struct question *question, int *returnval, int *lzerrno, char *replystring)
+lookup_zone(ddDB *db, struct question *question, int *returnval, int *lzerrno, char *replystring, int replystringsize)
{
struct rbtree *rbt = NULL;
@@ -394,7 +394,7 @@ lookup_zone(ddDB *db, struct question *question, int *
} else {
free(rbt0);
/* answer the delegation */
- snprintf(replystring, DNS_MAXNAME, "%s", rbt->humanname);
+ snprintf(replystring, replystringsize, "%s", rbt->humanname);
*lzerrno = ERR_DELEGATE;
*returnval = -1;
return (rbt);
@@ -435,7 +435,7 @@ lookup_zone(ddDB *db, struct question *question, int *
}
if ((rrset = find_rr(rbt, DNS_TYPE_NS)) != NULL) {
- snprintf(replystring, DNS_MAXNAME, "%s", rbt->humanname);
+ snprintf(replystring, replystringsize, "%s", rbt->humanname);
*lzerrno = ERR_DELEGATE;
*returnval = -1;
return (rbt);
@@ -449,7 +449,7 @@ lookup_zone(ddDB *db, struct question *question, int *
return (NULL);
}
- snprintf(replystring, DNS_MAXNAME, "%s", rbt->humanname);
+ snprintf(replystring, replystringsize, "%s", rbt->humanname);
if ((ntohs(question->hdr->qtype) != DNS_TYPE_DS) &&
(rrset = find_rr(rbt, DNS_TYPE_NS)) != NULL &&
repomaster@centroid.eu