Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Implement secure_getenv(3) if not provided by stdlib #147
Conversation
|
Spread failures are caused by out-of-date things in the image. Let me try to get spread to update everything first. |
| +#include <sys/auxv.h> | ||
| + | ||
| +#ifndef HAVE_SECURE_GETENV | ||
| +char *secure_getenv(const char *name) |
chipaca
Sep 19, 2016
Member
you could add __attribute__((nonnull)) so that gcc and clang warn you if you pass in null, i think?
| +char *secure_getenv(const char *name) | ||
| +{ | ||
| + unsigned long secure = getauxval(AT_SECURE); | ||
| + if (secure != 0) |
chipaca
Sep 19, 2016
Member
always use braces around ifs that aren't single-liners? Or maybe just always use braces around ifs.
| +#include <sys/auxv.h> | ||
| + | ||
| +#ifndef HAVE_SECURE_GETENV | ||
| +char *secure_getenv(const char *name) |
chipaca
Sep 19, 2016
Member
you could add __attribute__((nonnull)) so that gcc and clang warn you if you pass in null, i think?
| +char *secure_getenv(const char *name) | ||
| +{ | ||
| + unsigned long secure = getauxval(AT_SECURE); | ||
| + if (secure != 0) |
chipaca
Sep 19, 2016
Member
always use braces around ifs that aren't single-liners? Or maybe just always use braces around ifs.
|
Looks good to me too, thanks for adding this |
zyga
added some commits
Sep 19, 2016
zyga
merged commit 30f7ca1
into
master
Sep 19, 2016
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
zyga
deleted the
secure-getenv
branch
Sep 19, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zyga commentedSep 19, 2016
This patch changes the previous approach to falling back to unsecure
getenv if the standard library (e.g. musl) didn't provide the
secure_getenv() function. Snap confine now provides an internal copy of
the required library function instead.
Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com