Commit 1d739a95 authored by Mark Andrews's avatar Mark Andrews
Browse files

Merge branch...

Merge branch '1989-rndc-dnstap-roll-with-too-big-a-argument-128-can-cause-a-buffer-overflow' into 'main'

Resolve "'rndc dnstap --roll' with too big a argument (>128) can cause a buffer overflow."

Closes #1989

See merge request !3788
parents 98de8537 42b2290c
Pipeline #46625 passed with stages
in 72 minutes and 47 seconds
5464. [bug] Specifying saving more than 128 files when rolling
dnstap / log files would cause buffer overflow.
[GL #1989]
5463. [placeholder]
 
5462. [bug] Move LMDB locking from LMDB itself to named. [GL #1976]
......
......@@ -1156,10 +1156,13 @@ remove_old_tsversions(isc_logfile_t *file, int versions) {
}
if (versions > 0) {
if (versions > ISC_LOG_MAX_VERSIONS) {
versions = ISC_LOG_MAX_VERSIONS;
}
/*
* First we fill 'to_keep' structure using insertion sort
*/
memset(to_keep, 0, versions * sizeof(long long));
memset(to_keep, 0, sizeof(to_keep));
while (isc_dir_read(&dir) == ISC_R_SUCCESS) {
if (dir.entry.length > bnamelen &&
strncmp(dir.entry.name, bname, bnamelen) == 0 &&
......@@ -1176,9 +1179,9 @@ remove_old_tsversions(isc_logfile_t *file, int versions) {
if (i < versions) {
memmove(&to_keep[i + 1],
&to_keep[i],
sizeof(long long) *
versions -
i - 1);
sizeof(to_keep[0]) *
(versions - i -
1));
to_keep[i] = version;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment