Mercurial > dropbear
comparison svr-chansession.c @ 372:fbcc3b5b34f3
comment about putenv() leaking malloced variables
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 02 Nov 2006 16:52:59 +0000 |
parents | 8eaa6e3ca6eb |
children | a124aff0cbf1 |
comparison
equal
deleted
inserted
replaced
371:6aea2cfc113e | 372:fbcc3b5b34f3 |
---|---|
995 newvar = m_malloc(plen + vlen + 2); /* 2 is for '=' and '\0' */ | 995 newvar = m_malloc(plen + vlen + 2); /* 2 is for '=' and '\0' */ |
996 memcpy(newvar, param, plen); | 996 memcpy(newvar, param, plen); |
997 newvar[plen] = '='; | 997 newvar[plen] = '='; |
998 memcpy(&newvar[plen+1], var, vlen); | 998 memcpy(&newvar[plen+1], var, vlen); |
999 newvar[plen+vlen+1] = '\0'; | 999 newvar[plen+vlen+1] = '\0'; |
1000 /* newvar is leaked here, but that's part of putenv()'s semantics */ | |
1000 if (putenv(newvar) < 0) { | 1001 if (putenv(newvar) < 0) { |
1001 dropbear_exit("environ error"); | 1002 dropbear_exit("environ error"); |
1002 } | 1003 } |
1003 } | 1004 } |