Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Fix memory leakage related to tac_svr #73

Merged
merged 5 commits into from
Dec 3, 2016

Conversation

stanAtAtl
Copy link
Contributor

The memory blocks pointed by tac_srv[] are dynamically allocated in _pam_parse() when
server address in option "server" is parsed. But each time _pam_parse() is called,
tac_srv[] is nulled without de-allocating, so those blocks of memroy get "lost".

Those blocks of memory are allocated by getaddrinfo(), this patch uses freeaddrinfo()
to free them. Before releasing the memory, the actual address and key information is
saved to static memory.

Since act_srv[] may have different ip addresses and keys each time _pam_parse() is called,
the pointers in active_server may point to different server rather than the server being
active last time. This patch saves the active server address and key to specific static
memory and let active_server point to them.

@stanAtAtl stanAtAtl changed the title Add files via upload Fix memory leakage related to tac_svr Oct 12, 2016
@stanAtAtl stanAtAtl closed this Oct 12, 2016
@stanAtAtl stanAtAtl reopened this Oct 12, 2016
Replacing strncpy()  with strncpy()
Replacing strncpy()  with strncpy()
@jeroennijhof jeroennijhof merged commit 1cb49fc into kravietz:master Dec 3, 2016
@pprindeville
Copy link
Collaborator

@stanAtAtl, @jeroennijhof: I'm looking at this PR, and I'm thinking that it's partially at odds with PR #72 and PR #78, which attempt to move server parameters (like the secret) into a tac_session structure instead.

Maybe we should coordinate changes?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants