diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/charcnv.c | 6 | ||||
-rw-r--r-- | source3/lib/system.c | 4 | ||||
-rw-r--r-- | source3/lib/util.c | 16 |
3 files changed, 18 insertions, 8 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 4e3b7cba62..5e265234e6 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -1106,7 +1106,11 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx, } /* Ensure we don't use an insane length from the client. */ if (src_len >= 1024*1024) { - smb_panic("Bad src length in pull_ascii_base_talloc\n"); + char *msg = talloc_asprintf(ctx, + "Bad src length (%u) in " + "pull_ascii_base_talloc", + src_len); + smb_panic(msg); } } diff --git a/source3/lib/system.c b/source3/lib/system.c index 9cef818fab..6c79b362a8 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -573,7 +573,11 @@ char *sys_getwd(char *s) { char *wd; #ifdef HAVE_GETCWD +#ifdef PATH_MAX + wd = (char *)getcwd(s, PATH_MAX); +#else wd = (char *)getcwd(s, sizeof (pstring)); +#endif #else wd = (char *)getwd(s); #endif diff --git a/source3/lib/util.c b/source3/lib/util.c index 5314239e07..2d34371ab3 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1578,20 +1578,22 @@ BOOL process_exists_by_pid(pid_t pid) const char *uidtoname(uid_t uid) { - fstring name; - struct passwd *pass; + TALLOC_CTX *ctx = talloc_tos(); + char *name = NULL; + struct passwd *pass = NULL; - pass = getpwuid_alloc(talloc_tos(), uid); + pass = getpwuid_alloc(ctx,uid); if (pass) { - fstrcpy(name, pass->pw_name); + name = talloc_strdup(ctx,pass->pw_name); TALLOC_FREE(pass); } else { - slprintf(name, sizeof(name) - 1, "%ld",(long int)uid); + name = talloc_asprintf(ctx, + "%ld", + (long int)uid); } - return talloc_strdup(talloc_tos(), name); + return name; } - /******************************************************************* Convert a gid into a group name. ********************************************************************/ |