From 86f2c6782d0e59e633ec7ae44132fc4f46a32aaa Mon Sep 17 00:00:00 2001 From: Dave Olson Date: Thu, 25 May 2017 12:58:38 -0700 Subject: When re-using a secret key for multiple servers, strdup, don't copy Otherwise when reconfiguring when we detect a changed config file, we'll double free the strdup'ed memory. --- nss_tacplus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nss_tacplus.c b/nss_tacplus.c index 82d5902..7a632cd 100644 --- a/nss_tacplus.c +++ b/nss_tacplus.c @@ -260,7 +260,8 @@ static int nss_tacplus_config(int *errnop, const char *cfile, int top) tac_srv[tac_srv_no].addr = server; /* use current key, if our index not yet set */ if(tac_key_no && !tac_srv[tac_srv_no].key) - tac_srv[tac_srv_no].key = tac_srv[tac_key_no-1].key; + tac_srv[tac_srv_no].key = + strdup(tac_srv[tac_key_no-1].key); tac_srv_no++; } } -- cgit v1.2.3