diff options
Diffstat (limited to 'usr.sbin/bind/lib')
-rw-r--r-- | usr.sbin/bind/lib/dns/gen.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/usr.sbin/bind/lib/dns/gen.c b/usr.sbin/bind/lib/dns/gen.c index 28180939e67..a233ce558ae 100644 --- a/usr.sbin/bind/lib/dns/gen.c +++ b/usr.sbin/bind/lib/dns/gen.c @@ -287,14 +287,14 @@ insert_into_typenames(int type, const char *typename, const char *attr) { typename); exit(1); } - strcpy(ttn->typename, typename); + strlcpy(ttn->typename, typename, sizeof(ttn->typename)); } else if (strcmp(typename, ttn->typename) != 0) { fprintf(stderr, "Error: type %d has two names: %s, %s\n", type, ttn->typename, typename); exit(1); } - strcpy(ttn->macroname, ttn->typename); + strlcpy(ttn->macroname, ttn->typename, sizeof(ttn->macroname)); c = strlen(ttn->macroname); while (c > 0) { if (ttn->macroname[c - 1] == '-') @@ -303,7 +303,7 @@ insert_into_typenames(int type, const char *typename, const char *attr) { } if (attr == NULL) { - sprintf(tmp, "RRTYPE_%s_ATTRIBUTES", upper(ttn->macroname)); + snprintf(tmp, sizeof(tmp), "RRTYPE_%s_ATTRIBUTES", upper(ttn->macroname)); attr = tmp; } @@ -318,7 +318,7 @@ insert_into_typenames(int type, const char *typename, const char *attr) { attr, typename); exit(1); } - strcpy(ttn->attr, attr); + strlcpy(ttn->attr, attr, sizeof(ttn->attr)); ttn->sorted = 0; } @@ -341,9 +341,9 @@ add(int rdclass, const char *classname, int type, const char *typename, newtt->next = NULL; newtt->rdclass = rdclass; newtt->type = type; - strcpy(newtt->classname, classname); - strcpy(newtt->typename, typename); - strcpy(newtt->dirname, dirname); + strlcpy(newtt->classname, classname, sizeof(newtt->classname)); + strlcpy(newtt->typename, typename, sizeof(newtt->typename)); + strlcpy(newtt->dirname, dirname, sizeof(newtt->dirname)); tt = types; oldtt = NULL; @@ -377,7 +377,7 @@ add(int rdclass, const char *classname, int type, const char *typename, newcc = (struct cc *)malloc(sizeof *newcc); newcc->rdclass = rdclass; - strcpy(newcc->classname, classname); + strlcpy(newcc->classname, classname, sizeof(newcc->classname)); cc = classes; oldcc = NULL; @@ -409,14 +409,14 @@ sd(int rdclass, const char *classname, const char *dirname, char filetype) { if (!start_directory(dirname, &dir)) return; - sprintf(fmt,"%s%c", "%10[-0-9a-z]_%d.", filetype); + snprintf(fmt, sizeof(fmt), "%s%c", "%10[-0-9a-z]_%d.", filetype); while (next_file(&dir)) { if (sscanf(dir.filename, fmt, typename, &type) != 2) continue; if ((type > 65535) || (type < 0)) continue; - sprintf(buf, "%s_%d.%c", typename, type, filetype); + snprintf(buf, sizeof(buf), "%s_%d.%c", typename, type, filetype); if (strcmp(buf, dir.filename) != 0) continue; add(rdclass, classname, type, typename, dirname); @@ -472,7 +472,7 @@ main(int argc, char **argv) { for (i = 0 ; i <= 255 ; i++) memset(&typenames[i], 0, sizeof(typenames[i])); - strcpy(srcdir, ""); + strlcpy(srcdir, "", sizeof(srcdir)); while ((c = isc_commandline_parse(argc, argv, "cdits:F:P:S:")) != -1) switch (c) { case 'c': @@ -508,7 +508,7 @@ main(int argc, char **argv) { filetype = 'h'; break; case 's': - sprintf(srcdir, "%s/", isc_commandline_argument); + snprintf(srcdir, sizeof(srcdir), "%s/", isc_commandline_argument); break; case 'F': file = isc_commandline_argument; @@ -523,7 +523,7 @@ main(int argc, char **argv) { exit(1); } - sprintf(buf, "%srdata", srcdir); + snprintf(buf, sizeof(buf), "%srdata", srcdir); if (!start_directory(buf, &dir)) exit(1); @@ -535,18 +535,18 @@ main(int argc, char **argv) { if ((rdclass > 65535) || (rdclass < 0)) continue; - sprintf(buf, "%srdata/%s_%d", srcdir, classname, rdclass); + snprintf(buf, sizeof(buf), "%srdata/%s_%d", srcdir, classname, rdclass); if (strcmp(buf + 6 + strlen(srcdir), dir.filename) != 0) continue; sd(rdclass, classname, buf, filetype); } end_directory(&dir); - sprintf(buf, "%srdata/generic", srcdir); + snprintf(buf, sizeof(buf), "%srdata/generic", srcdir); sd(0, "", buf, filetype); if (time(&now) != -1) { if ((tm = localtime(&now)) != NULL && tm->tm_year > 98) - sprintf(year, "-%d", tm->tm_year + 1900); + snprintf(year, sizeof(year), "-%d", tm->tm_year + 1900); else year[0] = 0; } else @@ -814,7 +814,7 @@ main(int argc, char **argv) { } } for (tt = types; tt != NULL ; tt = tt->next) { - sprintf(buf, "%s/%s_%d.h", + snprintf(buf, sizeof(buf), "%s/%s_%d.h", tt->dirname, tt->typename, tt->type); if ((fd = fopen(buf,"r")) != NULL) { while (fgets(buf, sizeof buf, fd) != NULL) |