summaryrefslogtreecommitdiff
path: root/libbb/my_getgrgid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/my_getgrgid.c')
-rw-r--r--libbb/my_getgrgid.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libbb/my_getgrgid.c b/libbb/my_getgrgid.c
index 907a474..e6b8776 100644
--- a/libbb/my_getgrgid.c
+++ b/libbb/my_getgrgid.c
@@ -27,16 +27,16 @@
/* gets a groupname given a gid */
-char * my_getgrgid(char *group, long gid)
+char * my_getgrgid(char *group, long gid, int bufsize)
{
struct group *mygroup;
mygroup = getgrgid(gid);
if (mygroup==NULL) {
- sprintf(group, "%ld", gid);
+ snprintf(group, bufsize, "%ld", gid);
return NULL;
} else {
- return strcpy(group, mygroup->gr_name);
+ return safe_strncpy(group, mygroup->gr_name, bufsize);
}
}