2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Merge branch 'each-silence-warning' into 'master'

silence a warning about potential snprintf overrun

See merge request isc-projects/bind9!1558
This commit is contained in:
Evan Hunt
2019-03-08 00:46:17 -05:00

View File

@@ -27,6 +27,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h> #include <ctype.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -133,7 +134,6 @@ static const char copyright[] =
#define TYPECLASSBUF (TYPECLASSLEN + 1) #define TYPECLASSBUF (TYPECLASSLEN + 1)
#define TYPECLASSFMT "%" STR(TYPECLASSLEN) "[-0-9a-z]_%d" #define TYPECLASSFMT "%" STR(TYPECLASSLEN) "[-0-9a-z]_%d"
#define ATTRIBUTESIZE 256 #define ATTRIBUTESIZE 256
#define DIRNAMESIZE 256
static struct cc { static struct cc {
struct cc *next; struct cc *next;
@@ -143,11 +143,11 @@ static struct cc {
static struct tt { static struct tt {
struct tt *next; struct tt *next;
int rdclass; uint16_t rdclass;
int type; uint16_t type;
char classbuf[TYPECLASSBUF]; char classbuf[TYPECLASSBUF];
char typebuf[TYPECLASSBUF]; char typebuf[TYPECLASSBUF];
char dirbuf[DIRNAMESIZE-30]; /* XXX Should be max path length */ char dirbuf[PATH_MAX-30];
} *types; } *types;
static struct ttnam { static struct ttnam {
@@ -155,7 +155,7 @@ static struct ttnam {
char macroname[TYPECLASSBUF]; char macroname[TYPECLASSBUF];
char attr[ATTRIBUTESIZE]; char attr[ATTRIBUTESIZE];
unsigned int sorted; unsigned int sorted;
int type; uint16_t type;
} typenames[TYPENAMES]; } typenames[TYPENAMES];
static int maxtype = -1; static int maxtype = -1;
@@ -383,7 +383,7 @@ add(int rdclass, const char *classbuf, int type, const char *typebuf,
INSIST(strlen(typebuf) < TYPECLASSBUF); INSIST(strlen(typebuf) < TYPECLASSBUF);
INSIST(strlen(classbuf) < TYPECLASSBUF); INSIST(strlen(classbuf) < TYPECLASSBUF);
INSIST(strlen(dirbuf) < DIRNAMESIZE); INSIST(strlen(dirbuf) < PATH_MAX);
insert_into_typenames(type, typebuf, NULL); insert_into_typenames(type, typebuf, NULL);
@@ -520,8 +520,8 @@ HASH(char *string) {
int int
main(int argc, char **argv) { main(int argc, char **argv) {
char buf[DIRNAMESIZE]; /* XXX Should be max path length */ char buf[PATH_MAX];
char srcdir[DIRNAMESIZE]; /* XXX Should be max path length */ char srcdir[PATH_MAX];
int rdclass; int rdclass;
char classbuf[TYPECLASSBUF]; char classbuf[TYPECLASSBUF];
struct tt *tt; struct tt *tt;
@@ -586,7 +586,7 @@ main(int argc, char **argv) {
break; break;
case 's': case 's':
if (strlen(isc_commandline_argument) > if (strlen(isc_commandline_argument) >
DIRNAMESIZE - 2 * TYPECLASSLEN - PATH_MAX - 2 * TYPECLASSLEN -
sizeof("/rdata/_65535_65535")) sizeof("/rdata/_65535_65535"))
{ {
fprintf(stderr, "\"%s\" too long\n", fprintf(stderr, "\"%s\" too long\n",