summaryrefslogtreecommitdiff
path: root/libbb/my_getpwuid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/my_getpwuid.c')
-rw-r--r--libbb/my_getpwuid.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libbb/my_getpwuid.c b/libbb/my_getpwuid.c
index 21a037f..53f6c77 100644
--- a/libbb/my_getpwuid.c
+++ b/libbb/my_getpwuid.c
@@ -28,16 +28,16 @@
/* gets a username given a uid */
-char * my_getpwuid(char *name, long uid)
+char * my_getpwuid(char *name, long uid, int bufsize)
{
struct passwd *myuser;
myuser = getpwuid(uid);
if (myuser==NULL) {
- sprintf(name, "%ld", (long)uid);
+ snprintf(name, bufsize, "%ld", (long)uid);
return NULL;
} else {
- return strcpy(name, myuser->pw_name);
+ return safe_strncpy(name, myuser->pw_name, bufsize);
}
}