summaryrefslogtreecommitdiff
path: root/libpam_misc/help_env.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpam_misc/help_env.c')
-rw-r--r--libpam_misc/help_env.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libpam_misc/help_env.c b/libpam_misc/help_env.c
index 2b800283..601c5f41 100644
--- a/libpam_misc/help_env.c
+++ b/libpam_misc/help_env.c
@@ -5,6 +5,8 @@
*
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -72,9 +74,7 @@ int pam_misc_setenv(pam_handle_t *pamh, const char *name
return PAM_PERM_DENIED; /* not allowed to overwrite */
}
}
- tmp = malloc(2+strlen(name)+strlen(value));
- if (tmp != NULL) {
- sprintf(tmp,"%s=%s",name,value);
+ if (asprintf(&tmp, "%s=%s", name, value) >= 0) {
D(("pam_putt()ing: %s", tmp));
retval = pam_putenv(pamh, tmp);
_pam_overwrite(tmp); /* purge */