On Wed, 2021-10-27 at 14:14 -0600, Todd C. Miller wrote:
> On Wed, 27 Oct 2021 17:14:28 +0100, Martijn van Duren wrote:
>
> > Trying to search for memory leaks in my new snmpd code I found some
> > harmless, but annoying ones in system from SNMPv2-MIB.
> >
> > We call uname(3) every time (even if we don't even need info from
> > that call) and ones set we save it until forever.
> >
> > Diff below calls uname(3) only a single time and if the variables
> > aren't snmpd.conf I simply rebuild it every time.
>
> It's possible that 256 bytes will not be sufficient. I think you
> need to make the buffer sizeof(struct utsname) bytes.
>
> - todd
Maybe it's not sufficient, but:
sysDescr OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"A textual description of the entity. This value should
include the full name and version identification of
the system's hardware type, software operating-system,
and networking software."
::= { system 1 }