libxl: dm_restrict: DEFINE_USERLOOKUP_HELPER returned a pointer to an auto
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 13 Oct 2017 10:21:57 +0000 (11:21 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 13 Oct 2017 10:31:59 +0000 (11:31 +0100)
commit6cde84a81b157828ec421f84b8c7fb1b649a7306
tree208dea9a717cf522d02e2391320f1c52b5305b9e
parentcc08c73c8c1f5ba5ed0f8274548db6725e1c3157
libxl: dm_restrict: DEFINE_USERLOOKUP_HELPER returned a pointer to an auto

When I converted the previous open-coded user lookup functionality
into DEFINE_USERLOOKUP_HELPER, I moved the struct passwd buffer into
the function generated by the macro.  This is wrong because that
buffer is used by get{pw,gr}* for its return value, so the helper
function would contrive to return a pointer to the buffer on its own
stack.

Fix this by adding a buffer parameter to the generated helpers, that
the caller must supply, and updating all the call sites.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl_dm.c