summaryrefslogtreecommitdiffstats
path: root/common/os_calls.c
diff options
context:
space:
mode:
authorspeidy <speidy@gmail.com>2016-07-22 04:48:37 -0400
committerspeidy <speidy@gmail.com>2016-07-22 04:48:37 -0400
commitc9b55e3691624878a990fb5ef71bc4eb9e81bf50 (patch)
treee4beb64b15639c924cf6643d665cd58f36074f09 /common/os_calls.c
parent703fedded71700c8b1cc4181ea112828ea5b236b (diff)
downloadxrdp-proprietary-c9b55e3691624878a990fb5ef71bc4eb9e81bf50.tar.gz
xrdp-proprietary-c9b55e3691624878a990fb5ef71bc4eb9e81bf50.zip
sesman: env_set_user, fix potential bof issues
Diffstat (limited to 'common/os_calls.c')
-rw-r--r--common/os_calls.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index dbef8da6..2c8e37cd 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -207,14 +207,17 @@ g_sprintf(char *dest, const char *format, ...)
}
/*****************************************************************************/
-void DEFAULT_CC
+int DEFAULT_CC
g_snprintf(char *dest, int len, const char *format, ...)
{
+ int err;
va_list ap;
va_start(ap, format);
- vsnprintf(dest, len, format, ap);
+ err = vsnprintf(dest, len, format, ap);
va_end(ap);
+
+ return err;
}
/*****************************************************************************/
@@ -2995,10 +2998,11 @@ g_sigterm(int pid)
/*****************************************************************************/
/* returns 0 if ok */
+/* the caller is responsible to free the buffs */
/* does not work in win32 */
int APP_CC
-g_getuser_info(const char *username, int *gid, int *uid, char *shell,
- char *dir, char *gecos)
+g_getuser_info(const char *username, int *gid, int *uid, char **shell,
+ char **dir, char **gecos)
{
#if defined(_WIN32)
return 1;
@@ -3021,17 +3025,17 @@ g_getuser_info(const char *username, int *gid, int *uid, char *shell,
if (dir != 0)
{
- g_strcpy(dir, pwd_1->pw_dir);
+ *dir = g_strdup(pwd_1->pw_dir);
}
if (shell != 0)
{
- g_strcpy(shell, pwd_1->pw_shell);
+ *shell = g_strdup(pwd_1->pw_shell);
}
if (gecos != 0)
{
- g_strcpy(gecos, pwd_1->pw_gecos);
+ *gecos = g_strdup(pwd_1->pw_gecos);
}
return 0;