]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/res.c
Some clang static analyzer fixes.
[irc/rqf/shadowircd.git] / src / res.c
index bf1b32af30bc0e78821e148514ddff0d6fe8033e..2dac47f31fdbef9964013fb63562d15c2e0fd97c 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -7,8 +7,6 @@
  * The authors takes no responsibility for any damage or loss
  * of property which results from the use of this software.
  *
- * $Id: res.c 3301 2007-03-28 15:04:06Z jilles $
- * from Hybrid Id: res.c 459 2006-02-12 22:21:37Z db $
  *
  * July 1999 - Rewrote a bunch of stuff here. Change hostent builder code,
  *     added callbacks and reference counting of returned hostents.
@@ -62,7 +60,7 @@ struct reslist
        int id;
        time_t ttl;
        char type;
-       char queryname[128];    /* name currently being queried */
+       char queryname[IRCD_RES_HOSTLEN + 1]; /* name currently being queried */
        char retries;           /* retry counter */
        char sends;             /* number of sends (>1 means resent) */
        time_t sentat;
@@ -433,10 +431,10 @@ void gethost_byaddr(const struct rb_sockaddr_storage *addr, struct DNSQuery *que
 static void do_query_name(struct DNSQuery *query, const char *name, struct reslist *request,
                          int type)
 {
-       char host_name[HOSTLEN + 1];
+       char host_name[IRCD_RES_HOSTLEN + 1];
 
-       rb_strlcpy(host_name, name, HOSTLEN + 1);
-       add_local_domain(host_name, HOSTLEN);
+       rb_strlcpy(host_name, name, IRCD_RES_HOSTLEN + 1);
+       add_local_domain(host_name, IRCD_RES_HOSTLEN);
 
        if (request == NULL)
        {
@@ -462,7 +460,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
        {
                request = make_request(query);
                memcpy(&request->addr, addr, sizeof(struct rb_sockaddr_storage));
-               request->name = (char *)rb_malloc(HOSTLEN + 1);
+               request->name = (char *)rb_malloc(IRCD_RES_HOSTLEN + 1);
        }
 
        if (addr->ss_family == AF_INET)
@@ -576,7 +574,7 @@ static void resend_query(struct reslist *request)
  */
 static int check_question(struct reslist *request, HEADER * header, char *buf, char *eob)
 {
-       char hostbuf[128];      /* working buffer */
+       char hostbuf[IRCD_RES_HOSTLEN + 1];     /* working buffer */
        unsigned char *current; /* current position in buf */
        int n;                  /* temp count */
 
@@ -597,7 +595,7 @@ static int check_question(struct reslist *request, HEADER * header, char *buf, c
  */
 static int proc_answer(struct reslist *request, HEADER * header, char *buf, char *eob)
 {
-       char hostbuf[HOSTLEN + 100];    /* working buffer */
+       char hostbuf[IRCD_RES_HOSTLEN + 100];   /* working buffer */
        unsigned char *current; /* current position in buf */
        int query_class;        /* answer class */
        int type;               /* answer type */
@@ -642,7 +640,7 @@ static int proc_answer(struct reslist *request, HEADER * header, char *buf, char
                        return (0);
                }
 
-               hostbuf[HOSTLEN] = '\0';
+               hostbuf[IRCD_RES_HOSTLEN] = '\0';
 
                /* With Address arithmetic you have to be very anal
                 * this code was not working on alpha due to that
@@ -708,7 +706,7 @@ static int proc_answer(struct reslist *request, HEADER * header, char *buf, char
                          else if (n == 0)
                                  return (0);   /* no more answers left */
 
-                         rb_strlcpy(request->name, hostbuf, HOSTLEN + 1);
+                         rb_strlcpy(request->name, hostbuf, IRCD_RES_HOSTLEN + 1);
 
                          return (1);
                          break;