mirror of
https://github.com/isc-projects/bind9.git
synced 2026-07-16 20:02:49 -04:00
Use larger buffers on snprintf buffer overflow false positives
(cherry picked from commit4eaf927571) (cherry picked from commit65536fb10b)
This commit is contained in:
parent
c576cb2ff6
commit
d894b2da79
2 changed files with 9 additions and 9 deletions
|
|
@ -454,11 +454,12 @@ totext_loc(ARGS_TOTEXT) {
|
|||
bool east;
|
||||
bool below;
|
||||
isc_region_t sr;
|
||||
char buf[sizeof("89 59 59.999 N 179 59 59.999 E "
|
||||
"-42849672.95m 90000000m 90000000m 90000000m")];
|
||||
char sbuf[sizeof("90000000m")];
|
||||
char hbuf[sizeof("90000000m")];
|
||||
char vbuf[sizeof("90000000m")];
|
||||
/* "89 59 59.999 N 179 59 59.999 E " */
|
||||
/* "-42849672.95m 90000000m 90000000m 90000000m"; */
|
||||
char buf[8*6 + 12*1 + 2*10 + sizeof(sbuf)+sizeof(hbuf)+sizeof(vbuf)];
|
||||
unsigned char size, hp, vp;
|
||||
unsigned long poweroften[8] = { 1, 10, 100, 1000,
|
||||
10000, 100000, 1000000, 10000000 };
|
||||
|
|
@ -550,7 +551,7 @@ totext_loc(ARGS_TOTEXT) {
|
|||
altitude -= 10000000;
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf(NULL, 0,
|
||||
"%d %d %d.%03d %s %d %d %d.%03d %s %s%lu.%02lum %s %s %s",
|
||||
d1, m1, s1, fs1, north ? "N" : "S",
|
||||
d2, m2, s2, fs2, east ? "E" : "W",
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ fromtext_in_dhcid(ARGS_FROMTEXT) {
|
|||
static inline isc_result_t
|
||||
totext_in_dhcid(ARGS_TOTEXT) {
|
||||
isc_region_t sr, sr2;
|
||||
char buf[sizeof(" ; 64000 255 64000")];
|
||||
size_t n;
|
||||
/* " ; 64000 255 64000" */
|
||||
char buf[5 + 3*5 + 1];
|
||||
|
||||
REQUIRE(rdata->type == dns_rdatatype_dhcid);
|
||||
REQUIRE(rdata->rdclass == dns_rdataclass_in);
|
||||
|
|
@ -55,10 +55,9 @@ totext_in_dhcid(ARGS_TOTEXT) {
|
|||
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
|
||||
RETERR(str_totext(/* ( */ " )", target));
|
||||
if (rdata->length > 2) {
|
||||
n = snprintf(buf, sizeof(buf), " ; %u %u %u",
|
||||
sr2.base[0] * 256U + sr2.base[1],
|
||||
sr2.base[2], rdata->length - 3U);
|
||||
INSIST(n < sizeof(buf));
|
||||
snprintf(NULL, 0, " ; %u %u %u",
|
||||
sr2.base[0] * 256U + sr2.base[1],
|
||||
sr2.base[2], rdata->length - 3U);
|
||||
RETERR(str_totext(buf, target));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue