Even if that value were never used, it should be initialized to a
defined value. Be it 0 or ~0, it does not matter. But it should not have
random value from stack, even in case it cannot be obtained by outer
requests.
On 19. 06. 22 23:48, Simon Kelley wrote:
On 13/06/2022 08:16, John Gilmour via Dnsmasq-discuss wrote:
Hello,
First time user so please bear with me.
I have some quite specific in-house code that relies on the
"cache->ttd" value. I have noticed that the function "cache_reload"
in "src/cache.c" defines the following variable:
struct crec lrec
Further down in this function it makes non-terminal records for all
locally-defined RRs. It may be more of a question but why are the
"ttd", "uid" and "ns_id" fields not initialized before the various
calls to "make_non_terminals(&lrec)". When I check the value of the
"cache->ttd" in this function it's clearly just going to be random.
cache entries which don't expire are marked by setting the F_IMMORTAL
flag in the ->flags field. If that flag is set then the value of ->ttd
is meaningless and unused. It's done this way rather than assigning a
special value to ttd because the time scale varies in different
installations and there isn't a suitable "special" time value that
will always work.
Is this just an oversight or is deliberately not set?
See above.
Cheers,
Simon.
Best regards,
John.
--
Petr Menšík
Software Engineer, RHEL
Red Hat, http://www.redhat.com/
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB
_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss