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

1458. [cleanup] sprintf() -> snprintf().

This commit is contained in:
Mark Andrews
2003-04-11 07:25:31 +00:00
parent 935000aa6e
commit 806c235ecf
16 changed files with 83 additions and 69 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.c,v 1.173 2003/01/18 02:40:59 marka Exp $ */
/* $Id: rdata.c,v 1.174 2003/04/11 07:25:25 marka Exp $ */
#include <config.h>
#include <ctype.h>
@@ -782,11 +782,11 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
TOTEXTSWITCH
if (use_default) {
sprintf(buf, "\\# ");
strlcpy(buf, "\\# ", sizeof(buf));
result = str_totext(buf, target);
dns_rdata_toregion(rdata, &sr);
INSIST(sr.length < 65536);
sprintf(buf, "%u", sr.length);
snprintf(buf, sizeof(buf), "%u", sr.length);
result = str_totext(buf, target);
if (sr.length != 0 && result == ISC_R_SUCCESS) {
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
@@ -1037,7 +1037,7 @@ dns_mnemonic_totext(unsigned int value, isc_buffer_t *target,
}
i++;
}
sprintf(buf, "%u", value);
snprintf(buf, sizeof buf, "%u", value);
return (str_totext(buf, target));
}
@@ -1122,7 +1122,7 @@ dns_rdataclass_totext(dns_rdataclass_t rdclass, isc_buffer_t *target) {
case dns_rdataclass_reserved0:
return (str_totext("RESERVED0", target));
default:
sprintf(buf, "CLASS%u", rdclass);
snprintf(buf, sizeof(buf), "CLASS%u", rdclass);
return (str_totext(buf, target));
}
}
@@ -1197,7 +1197,7 @@ dns_rdatatype_totext(dns_rdatatype_t type, isc_buffer_t *target) {
char buf[sizeof("TYPE65536")];
if (type > 255) {
sprintf(buf, "TYPE%u", type);
snprintf(buf, sizeof buf, "TYPE%u", type);
return (str_totext(buf, target));
}
@@ -1377,7 +1377,7 @@ txt_totext(isc_region_t *source, isc_buffer_t *target) {
if (*sp < 0x20 || *sp >= 0x7f) {
if (tl < 4)
return (ISC_R_NOSPACE);
sprintf(tp, "\\%03u", *sp++);
snprintf(tp, 5, "\\%03u", *sp++);
tp += 4;
tl -= 4;
continue;
@@ -1936,7 +1936,7 @@ btoa_totext(unsigned char *inbuf, int inbuflen, isc_buffer_t *target) {
* Put byte count and checksum information at end of buffer,
* delimited by 'x'
*/
sprintf(buf, "x %d %x %x %x", inbuflen, Ceor, Csum, Crot);
snprintf(buf, sizeof(buf), "x %d %x %x %x", inbuflen, Ceor, Csum, Crot);
return (str_totext(buf, target));
}