diff -up tree-1.6.0/hash.c.fixbufsiz tree-1.6.0/hash.c
--- tree-1.6.0/hash.c.fixbufsiz 2011-06-24 15:25:18.000000000 +0100
+++ tree-1.6.0/hash.c 2013-07-04 11:35:29.909472389 +0100
@@ -25,11 +25,11 @@ struct xtable *gtable[256], *utable[256]
#define inohash(x) ((x)&255)
struct inotable *itable[256];
-char *uidtoname(int uid)
+char *uidtoname(uid_t uid)
{
struct xtable *o, *p, *t;
struct passwd *ent;
- char ubuf[6];
+ char ubuf[11];
int uent = HASH(uid);
for(o = p = utable[uent]; p ; p=p->nxt) {
@@ -41,7 +41,7 @@ char *uidtoname(int uid)
t = xmalloc(sizeof(struct xtable));
if ((ent = getpwuid(uid)) != NULL) t->name = scopy(ent->pw_name);
else {
- sprintf(ubuf,"%d",uid);
+ snprintf(ubuf, sizeof (ubuf), "%u", uid);
t->name = scopy(ubuf);
}
t->xid = uid;
@@ -51,11 +51,11 @@ char *uidtoname(int uid)
return t->name;
}
-char *gidtoname(int gid)
+char *gidtoname(gid_t gid)
{
struct xtable *o, *p, *t;
struct group *ent;
- char gbuf[6];
+ char gbuf[11];
int gent = HASH(gid);
for(o = p = gtable[gent]; p ; p=p->nxt) {
@@ -67,7 +67,7 @@ char *gidtoname(int gid)
t = xmalloc(sizeof(struct xtable));
if ((ent = getgrgid(gid)) != NULL) t->name = scopy(ent->gr_name);
else {
- sprintf(gbuf,"%d",gid);
+ snprintf(gbuf, sizeof (gbuf), "%u", gid);
t->name = scopy(gbuf);
}
t->xid = gid;
diff -up tree-1.6.0/tree.h.fixbufsiz tree-1.6.0/tree.h
--- tree-1.6.0/tree.h.fixbufsiz 2011-06-24 13:55:58.000000000 +0100
+++ tree-1.6.0/tree.h 2013-07-04 11:34:07.486808236 +0100
@@ -168,7 +168,7 @@ const char *getcharset(void);
void initlinedraw(int);
/* hash.c */
-char *gidtoname(int), *uidtoname(int);
+char *gidtoname(gid_t), *uidtoname(uid_t);
int findino(ino_t, dev_t);
void saveino(ino_t, dev_t);